Image links in PHP (Drupal)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • neu7o
    New Member
    • Dec 2009
    • 3

    Image links in PHP (Drupal)

    Seems simple, but it's driving me nuts. Does anyone know how to display image links in the footer & block regions of Drupal?
  • Dheeraj Joshi
    Recognized Expert Top Contributor
    • Jul 2009
    • 1129

    #2
    I don't think without looking at the code anybody can help you.
    So please post the relevant code which you think is creating problem.

    Regards
    Dheeraj Joshi

    Comment

    • neu7o
      New Member
      • Dec 2009
      • 3

      #3
      image links to display using PHP

      in general do you happen to know the syntax if someone needs to create an imagelink with PHP.

      Comment

      • Atli
        Recognized Expert Expert
        • Nov 2006
        • 5062

        #4
        Originally posted by neu7o
        in general do you happen to know the syntax if someone needs to create an imagelink with PHP.
        An image link. That would simply be an <img> tag wrapped in an <a> tag, right?

        In plain PHP code, that might look something like:
        [code=php]
        <?php
        $image_location = 'http://www.w3.org/2008/site/images/logo-w3c-mobile-lg.png';
        $url_link = 'http://www.w3.org/';
        $url_title = "Click here to visit the World Wide Web Consortium";

        echo "<a href=\"{$url_li nk}\">
        <img
        style=\"border: none;\"
        src=\"{$image_l ocation}\"
        alt=\"{$url_tit le}\"
        title=\"{$url_t itle}\"
        >
        </a>";
        ?>
        [/code]
        The style removes the blue border the browse automatically puts around the image. (I assume you don't want those)

        Not sure how this fits into Drupal though. I haven't worked with that one much.

        Comment

        • neu7o
          New Member
          • Dec 2009
          • 3

          #5
          Thanks Atli. Example works in Drupal.

          Right now I'm just testing locally. I'm using MAMP and have setup my root folder to point to /Users/MyUserName/Sites/ProjectNameFold er/.

          The path for "image_location " works if it's absolute (just like the example you gave) but if I put in a relative path it does not work (for example: /images/filename.jpg)

          I also tried using this path:
          file:///Users/UserName/Sites/ProjectNameFold er/images/filename.jpg

          Comment

          Working...