If I understand correctly, you want to replace the current path of the image with a new path, and does that path specify a different size? I did a way here to override the path, you can try to adapt to reach completion.
Note that I am using a different URL from the one you specified, but the solution can be adapted as I already said, I will show you how. My image is this:
<img src="http://www.rafaelalmeida.net78.net/exemplos/sopt/56952-src-img/100x150.png"class="thumb"/>
Notice that it is in the image name that the size is specified, being "300x340.png" the image with another size. Well, come on.
Code
First we need to go through all elements that have the class "thumb", after that, get their current value that is in the "src" attribute, then:
$("img.thumb").each(function() {
// Pega o caminho atual
var img_path = $(this).attr("src");
});
I found it appropriate to use regex
to solve the problem, so I made one that takes the size of the image:
var regex = /rafaelalmeida.net78.net\/exemplos\/sopt\/56952-src-img\/(.+).png/;
Notice that what is in the parentheses is the value to be taken, so in your case it would look like this:
var regex = /redir.com\?url=imgs.com\/img3356\/(.+)\/img.jpg/;
With the regex in hand, we test whether the image actually meets the requirements, if so, we get the value that the regex returns us and check if it is the value you want to change (in your case "100x1500":
if (regex.test(img_path)) {
// Se o caminho da imagem bater com o regex...
// Especifica o tamanho atual
var size = img_path.match(regex)[1];
if (size == "100x150") {
// Se o tamanho for 100x150...
}
}
Now it's simple, we replaced the string that had the old value with the new one using the same regex and finally changed the value of src
to the new path:
// Substitui o antigo caminho com o novo tamanho
var new_path = img_path.replace(size, "300x340");
// Atribui o novo valor ao atributo "src"
$(this).attr("src", new_path);
Final code
With this we have our final code:
$(document).ready(function() {
// Percore todas as imagens com a classe "thumb"
$("img.thumb").each(function() {
// Pega o caminho atual
var img_path = $(this).attr("src");
// Define o regex
var regex = /rafaelalmeida.net78.net\/exemplos\/sopt\/56952-src-img\/(.+).png/;
if (regex.test(img_path)) {
// Se o caminho da imagem bater com o regex...
// Especifica o tamanho atual
var size = img_path.match(regex)[1];
if (size == "100x150") {
// Se o tamanho for 100x150...
// Substitui o antigo caminho com o novo tamanho
var new_path = img_path.replace(size, "300x340");
// Atribui o novo valor ao atributo "src"
$(this).attr("src", new_path);
}
}
});
});
Fiddle: link
I used two different addresses for the images, one with the www and another without, to see that the regex works with both.