Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6721517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:20:22+00:00 2026-05-26T09:20:22+00:00

this is the HTML on everypost <div class=post-body> <a href=http://www.google.com>google</a> <a href=http://www.youtube.com>youtube</a> <a href=http://www.facebook.com>facebook</a>

  • 0

this is the HTML on everypost

<div class="post-body">
<a href="http://www.google.com">google</a>
<a href="http://www.youtube.com">youtube</a>
<a href="http://www.facebook.com">facebook</a>
</div>

for each link for eg <a href="http://www.google.com">google</a> add an image with the same hyperlink in this case <a href="http://www.google.com">google</a> and within the image src
add the hyperlink after http://open.thumbshots.org/image.aspx?url= so the outcome will be <img src="http://open.thumbshots.org/image.aspx?url=http://www.google.com" width="120px" />

the code below is the outcome for the html in every post.

 <div class="post-body">
    <a href="http://www.google.com">google</a>
    <a href="http://www.google.com"><img src="http://open.thumbshots.org/image.aspx?url=http://www.google.com" width="120px" /></a>


    <a href="http://www.youtube.com">youtube</a>
    <a href="http://www.youtube.com"><img src="http://open.thumbshots.org/image.aspx?url=http://www.youtube.com" width="120px" /></a>


    <a href="http://www.facebook.com">facebook</a>
    <a href="http://www.facebook.com"><img src="http://open.thumbshots.org/image.aspx?url=http://www.facebook.com" width="120px" /></a>
    </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:20:22+00:00Added an answer on May 26, 2026 at 9:20 am

    This is relatively simple:

    $('.post-body a').each(
        function(){
            $('<img />').attr('src','http://open.thumbshots.org/image.aspx?url='+ this.href).insertAfter($(this));
        });
    

    JS Fiddle demo.

    Though it might be wise to run the website URLs through encodeURIComponent(), just to be on the safe side:

    $('.post-body a').each(
        function(){
            $('<img />').attr('src','http://open.thumbshots.org/image.aspx?url='+encodeURIComponent(this.href)).insertAfter($(this));
        });
    

    JS Fiddle demo.

    Also, and just for the sake of demonstration, if not thoroughness, this doesn’t really require jQuery; the same could be achieved using plain JavaScript (albeit in a rather less concise manner):

    var container = document.getElementsByClassName('post-body')[0];
    var links = container.getElementsByTagName('a');
    var imgSrc = 'http://open.thumbshots.org/image.aspx?url=';
    
    for (i = 0; i < links.length; i++) {
        var img = document.createElement('img');
        var linkURL = encodeURIComponent(links[i].href);
        img.src = imgSrc + linkURL;
        container.insertBefore(img,links[i].nextSibling);
    }
    

    JS Fiddle demo.

    With regards to Floyd Pink’s comment, I must confess that I missed the need for the image to be a link also. The following is a somewhat messy way of taking care of that, though I feel there must be a far tidier way:

    $('.post-body a').each(
    
    function() {
        $('<img />').attr('src', 'http://open.thumbshots.org/image.aspx?url=' + encodeURIComponent(this.href)).insertAfter($(this)).parent().find('img:last').wrap('<a></a>').closest('a').attr('href',this.href);
    });
    

    JS Fiddle demo.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this html. <a class=link href=www.website.com?id=233253>test1</a> <a class=link href=www.website.com?id=456456>test2</a> How can I hide
I have to parse this HTML: <a href=rtsp://v8.cache2.c.youtube.com/CjgLENy73wIaLwnqnxbpjjoGIRMYESARFEIJbXYtZ29vZ2xlSARSB3Jlc3VsdHNgpq6joefRgbhNDA==/0/0/0/video.3gp><img src=http://i.ytimg.com/vi/IQY6jukWn-o/default.jpg?w=80&amp;h=60&amp;sigh=izeIwhz4POtPOOr-jRGrtC4qiFA alt=video width=80 height=60 style=border:0;margin:0px; /></a>
Given this html: <div class=nation> <a href=library.php?type=nation&amp;id=America> <div class=nation-image> <img src=nations/America.png alt=snip /> </div>
i have this html code <div class=container id=container> <div class=post><h1>first title</h1>description here</div> <div class=post><h1>second
I have this HTML <div class=box> <a href=#goals> | <a href=#rules> | <a href=#controls>
Is this html <div class='title centered'>SCE</div> <div class='description'> Magna tristique pulvinar porta montes, scelerisque
Given this HTML: <div class=OpenIDSelector>some text</div> Why does this JQuery selector match it on
I have this html structure: <div id=home> <div class=section_header> <h1 class=left data-target=newest><?=lang('home_newest');?></h1> ... </div>
Given this HTML: <div id=flashcard-001 class=flashcard> <div class=question>What color is the sky?</div> <div class=answer>blue</div>
For this HTML: <div id=idName class=className> ... </div> I know this is correct selector

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.