게시판 » 제작 요청

convert gif to url

§
작성: 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

§
작성: 2015-03-19
수정: 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

woxxom관리자
§
작성: 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>');
});
§
작성: 2015-03-19
수정: 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?

woxxom관리자
§
작성: 2015-03-20

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

§
작성: 2015-03-20

thank you, working cool!

댓글 남기기

댓글을 남기려면 로그인하세요.