Help for Newbie! Need to create a link to larger image target _blank in PHP

Thread Solved

Join Date: Sep 2008
Posts: 4
Reputation: AlanW is an unknown quantity at this point 
Solved Threads: 0
AlanW AlanW is offline Offline
Newbie Poster

Help for Newbie! Need to create a link to larger image target _blank in PHP

 
0
  #1
Sep 18th, 2008
Hi
I have a site that I am struggling to get it to do what I need it to! I have managed to add how many photos appear but I cannot add A HREF links around these thumbnails to get a larger picture to appear in browser window. Code is below - all help appreciated. ( I want the 100X100 images to be clickable and show full size in another window)

  1. if(!empty($a1[image]))
  2. {
  3. $im_array = explode("|", $a1[image]);
  4.  
  5. $FirstImage = "<img src=\"re_images/$im_array[0]\" width=100 height=100 border=1>";
  6.  
  7. $SecondImage = "<img src=\"re_images/$im_array[1]\" width=100 height=100 border=1>";
  8.  
  9. $ThirdImage = "<img src=\"re_images/$im_array[2]\" width=100 height=100 border=1>";
  10.  
  11. $FourthImage = "<img src=\"re_images/$im_array[3]\" width=100 height=100 border=1>";
  12.  
  13. $FifthImage = "<img src=\"re_images/$im_array[4]\" width=100 height=100 border=1>";
  14.  
  15. $SixthImage = "<img src=\"re_images/$im_array[5]\" width=100 height=100 border=1>";
  16.  
  17. }
  18.  
  19.  
  20. $ShowInfo .= "</td>\n\t<td align=center valign=top>$FirstImage<br>$SecondImage<br>$ThirdImage<br>$FourthImage<br>$FifthImage<br>$SixthImage<br>For more information call<br><b> $a1[FirstName] $a1[LastName]<br>$a1[phone]</b><br>or click <a class=RedLink href=\"email.php?AgentID=$a1[AgentID]&ListingID=$a1[ListingID]\">here</a> to email.<center>";
  21.  
  22.  
  23. $ShowInfo .= "</center></td>\n</tr>";
Last edited by peter_budo; Sep 18th, 2008 at 12:58 pm. Reason: Keep It Organized - please use [code] tags
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 47
Reputation: Banderson is an unknown quantity at this point 
Solved Threads: 4
Banderson's Avatar
Banderson Banderson is offline Offline
Light Poster

Re: Help for Newbie! Need to create a link to larger image target _blank in PHP

 
0
  #2
Sep 18th, 2008
Could you not put the link in the array like:

  1.  
  2. <?php
  3. if(!empty($a1[image]))
  4. {
  5. $im_array = explode("|", $a1[image]);
  6.  
  7. $FirstImage = "<a href=\"link_to_your_image\" target=\"_blank\"><img src=\"re_images/$im_array[0]\" width=100 height=100 border=1></a>";
  8.  
  9. $SecondImage = "<a href=\"link_to_your_image\" target=\"_blank\"><img src=\"re_images/$im_array[1]\" width=100 height=100 border=1></a>";
  10.  
  11. $ThirdImage = "<a href=\"link_to_your_image\" target=\"_blank\"><img src=\"re_images/$im_array[2]\" width=100 height=100 border=1></a>";
  12.  
  13. $FourthImage = "<a href=\"link_to_your_image\" target=\"_blank\"><img src=\"re_images/$im_array[3]\" width=100 height=100 border=1></a>";
  14.  
  15. $FifthImage = "<a href=\"link_to_your_image\" target=\"_blank\"><img src=\"re_images/$im_array[4]\" width=100 height=100 border=1></a>";
  16.  
  17. $SixthImage = "<a href=\"link_to_your_image\" target=\"_blank\"><img src=\"re_images/$im_array[5]\" width=100 height=100 border=1></a>";
  18.  
  19. }
  20.  
  21.  
  22. $ShowInfo .= "</td>\n\t<td align=center valign=top>$FirstImage<br>$SecondImage<br>$ThirdImage<br>$FourthImage<br>$FifthImage<br>$SixthImage<br>For more information call<br><b> $a1[FirstName] $a1[LastName]<br>$a1[phone]</b><br>or click <a class=RedLink href=\"email.php?AgentID=$a1[AgentID]&ListingID=$a1[ListingID]\">here</a> to email.<center>";
  23.  
  24.  
  25. $ShowInfo .= "</center></td>\n</tr>";
  26. ?>

or am I misunderstanding the question?
Last edited by Banderson; Sep 18th, 2008 at 1:41 pm. Reason: Inserted target=blank
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 84
Reputation: MVied is an unknown quantity at this point 
Solved Threads: 5
MVied's Avatar
MVied MVied is offline Offline
Junior Poster in Training

Re: Help for Newbie! Need to create a link to larger image target _blank in PHP

 
0
  #3
Sep 18th, 2008
And if you're interested in making that code a little smaller:
  1. <?php
  2. if(!empty($a1[image])) {
  3. $im_array = explode("|", $a1[image]);
  4. $images = "";
  5.  
  6. if ($im_array !== false) {
  7. foreach ($im_array as $img) {
  8. $images .= "<a href=\"re_images/".$img."\" target=\"_blank\"><img src=\"re_images/".$img."\" width=\"100\" height=\"100\" border=\"1\" /></a><br />\n";
  9. }
  10. }
  11. }
  12.  
  13. $ShowInfo .= "</td>\n\t<td align=center valign=top>".$images."For more information call<br><b> ".$a1['FirstName']." ".$a1['LastName']."<br>".$a1'[phone']."</b><br>or click <a class=RedLink href=\"email.php?AgentID=".$a1['AgentID']."&ListingID=".$a1['ListingID']."\">here</a> to email.<center>";
  14. $ShowInfo .= "</center></td>\n</tr>";
  15. ?>
Last edited by MVied; Sep 18th, 2008 at 4:07 pm.
"We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." - Robert Wilensky
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 4
Reputation: AlanW is an unknown quantity at this point 
Solved Threads: 0
AlanW AlanW is offline Offline
Newbie Poster

Re: Help for Newbie! Need to create a link to larger image target _blank in PHP

 
0
  #4
Sep 19th, 2008
Hi
Thanks for your response. I tried that solution but I could not reference the image correctly. As they are being labelled as Image1 and so on in that line of code no matter what I tried to put in the area you labelled "link_to_your_image\" I could not get it to work and the page blanks out.

Thanks again - it's probably me being dumb and missing something obvious!
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 4
Reputation: AlanW is an unknown quantity at this point 
Solved Threads: 0
AlanW AlanW is offline Offline
Newbie Poster

Re: Help for Newbie! Need to create a link to larger image target _blank in PHP

 
0
  #5
Sep 19th, 2008
Hi
I have now cracked it thansk to your answer! I had the syntax wrong.

Following the way you have entered the link I tried entering alt text for the link but it just does not appear? Any ideas?
THanks
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 84
Reputation: MVied is an unknown quantity at this point 
Solved Threads: 5
MVied's Avatar
MVied MVied is offline Offline
Junior Poster in Training

Re: Help for Newbie! Need to create a link to larger image target _blank in PHP

 
0
  #6
Sep 19th, 2008
Originally Posted by AlanW View Post
Hi
I have now cracked it thansk to your answer! I had the syntax wrong.

Following the way you have entered the link I tried entering alt text for the link but it just does not appear? Any ideas?
THanks
Should be something like this:
  1. "<a href=\"re_images/".$img."\" target=\"_blank\"><img src=\"re_images/".$img."\" alt=\"ALT TEXT\"width=\"100\" height=\"100\" border=\"1\" /></a><br />\n";
"We've heard that a million monkeys at a million keyboards could produce the complete works of Shakespeare; now, thanks to the Internet, we know that is not true." - Robert Wilensky
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 4
Reputation: AlanW is an unknown quantity at this point 
Solved Threads: 0
AlanW AlanW is offline Offline
Newbie Poster

Re: Help for Newbie! Need to create a link to larger image target _blank in PHP

 
0
  #7
Sep 19th, 2008
Thanks for all your help - much appreciated
Regards
Alan
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:




Views: 726 | Replies: 6
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC