Greasy Fork is available in English.

Discuții » Cerere de creare

convert gif to url

§
Postat în: 19-03-2015

convert gif to url

hello, so i have this http://jsfiddle.net/4q2tjLg3/

pic
ÎnchideЗакрыть

how to convert the gif to url, to change image src to text link, please and thank you

§
Postat în: 19-03-2015
Editat în: 19-03-2015

so instead of gif it will show only url like this
http://zamolxismd.org/m/forgifs.com/gallery/d/221051-2/Girl-picture-poses.gif

woxxomMod
§
Postat în: 19-03-2015

Since you like jQuery, something like this:

$('img.undefined[src*=".gif"]').each(function() {
    $(this).replaceWith('<a href="' + this.src + '">' + this.src + '</a>');
});
§
Postat în: 19-03-2015
Editat în: 19-03-2015

thank you again! one more question please, if the image in link contains words /pic/smilies/ , how can i exclude this image not be transformed in link?

woxxomMod
§
Postat în: 20-03-2015

Simply add if (this.src.indexOf('/pic/smilies/') < 0) at the start of line 2.

§
Postat în: 20-03-2015

thank you, working cool!

Postează un raspuns

Autentifică-te pentru a posta un răspuns.