468,490 Members | 2,644 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,490 developers. It's quick & easy.

Image links in PHP (Drupal)

3
Seems simple, but it's driving me nuts. Does anyone know how to display image links in the footer & block regions of Drupal?
Dec 30 '09 #1
4 9404
Dheeraj Joshi
1,123 Expert 1GB
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
Dec 31 '09 #2
neu7o
3
in general do you happen to know the syntax if someone needs to create an imagelink with PHP.
Dec 31 '09 #3
Atli
5,058 Expert 4TB
@neu7o
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:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $image_location = 'http://www.w3.org/2008/site/images/logo-w3c-mobile-lg.png';
  3. $url_link = 'http://www.w3.org/';
  4. $url_title = "Click here to visit the World Wide Web Consortium";
  5.  
  6. echo "<a href=\"{$url_link}\">
  7.           <img
  8.             style=\"border: none;\"
  9.             src=\"{$image_location}\" 
  10.             alt=\"{$url_title}\"
  11.             title=\"{$url_title}\"
  12.           >
  13.       </a>";
  14. ?>
  15.  
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.
Jan 17 '10 #4
neu7o
3
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/ProjectNameFolder/.

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/ProjectNameFolder/images/filename.jpg
Jan 22 '10 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by Karl Burrows | last post: by
16 posts views Thread by Harry Putnam | last post: by
1 post views Thread by fif3336 | last post: by
7 posts views Thread by Cate Archer | last post: by
reply views Thread by Iain | last post: by
6 posts views Thread by David Stone | last post: by
5 posts views Thread by Roy Smith | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by theflame83 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.