Here is my script:
function createSummaryAndThumb(pID) {
var div = document.getElementById(pID);
var imgtag = "";
var img = div.getElementsByTagName("img");
var summ = summary_noimg;
if(img.length >= 1) {
imgtag = '<span class="thumbnail pull-left"><img src="' + img[0].srcreplace('/s640/', '/s' + image_size + '/') + '" width="' + img_thumb_width + 'px" height="' + img_thumb_height + 'px"/></span>';
summ = summary_img;
}
var summary = imgtag + '<p>' + removeHtmlTag(div.innerHTML, summ) + '</p>';
div.innerHTML = summary;
}
The above script will replace /s640 with /image_size. But what can i do so that it change any value of the portion ‘640’. I’ve tried this but it won’t worked-
function createSummaryAndThumb(pID) {
var div = document.getElementById(pID);
var imgtag = "";
var img = div.getElementsByTagName("img");
var summ = summary_noimg;
if(img.length >= 1) {
if (uh>img_thumb_width) imgtag = '<span class="thumbnail pull-left"><img src="' + img[0].src.replace('/s' + uh + '/', '/s' + img_thumb_width + '/') + '" width="' + img_thumb_width + 'px" height="' + img_thumb_height + 'px"/></span>';
summ = summary_img;
}
var summary = imgtag + '<p>' + removeHtmlTag(div.innerHTML, summ) + '</p>';
div.innerHTML = summary;
}
You need to match the number inside with something like:
Here’s an example: http://jsfiddle.net/nfDea/
Another option is to capture the beginning and end only, in order to concatenate:
http://jsfiddle.net/nfDea/1/
If you are actually referring to a variable called
uh, then you need to use the following:http://jsfiddle.net/nfDea/4/
or
http://jsfiddle.net/nfDea/3/