Discussions » Creation Requests

convert gif to url

§
Posted: 2015-03-19

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

§
Posted: 2015-03-19
Edited: 2015-03-19

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
§
Posted: 2015-03-19

Since you like jQuery, something like this:

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

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
§
Posted: 2015-03-20

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

§
Posted: 2015-03-20

thank you, working cool!

Post reply

Sign in to post a reply.