Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Nov 2012
    Posts
    11
    Thanks
    3
    Thanked 0 Times in 0 Posts

    php link from a echo image source. Please help!

    Hi guys,
    I need your help.
    I created a snapshot of a website, but upto now it is just an image. How do I get that it becomes a link?? I am getting devasted. Please help.
    Thanks very much in advance.

    PHP Code:
    <?php
        $url 
    "http://www.ggg.de";
        echo 
    '<img src="http://open.thumbshots.org/image.aspx?url='.$url.'" width = "150" height = "150" />';
        
    ?>
    Last edited by gwolff2005; 01-31-2013 at 08:25 PM.

  • #2
    New Coder
    Join Date
    Dec 2012
    Location
    USA
    Posts
    82
    Thanks
    3
    Thanked 17 Times in 17 Posts
    Wrap it in anchor tags.

    PHP Code:
    echo '<a href="'.$url.'"><img ... /></a>'

  • Users who have thanked TFlan for this post:

    gwolff2005 (01-31-2013)

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,633
    Thanks
    0
    Thanked 649 Times in 639 Posts
    This is actually an HTML question rather than a PHP one since tat the HTML is being echoed from PHP is not relevant.

    To convert an image into an image link in HTML you simply wrap the <img> tag inside <a></a> with the href attribute of the <a> tag identifying where the image links to.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #4
    New Coder
    Join Date
    Nov 2012
    Posts
    11
    Thanks
    3
    Thanked 0 Times in 0 Posts
    Hi Tflan. It worked. thanks so much!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •