AlanW Posted September 18, 2008 Share Posted September 18, 2008 I have a site that I am struggling to get it to do what I need it to! I have managed to change 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) Thanks in advance for any help if(!empty($a1[image])) { $im_array = explode("|", $a1[image]); $FirstImage = "<img src=\"re_images/$im_array[0]\" width=100 height=100 border=1>"; $SecondImage = "<img src=\"re_images/$im_array[1]\" width=100 height=100 border=1>"; $ThirdImage = "<img src=\"re_images/$im_array[2]\" width=100 height=100 border=1>"; $FourthImage = "<img src=\"re_images/$im_array[3]\" width=100 height=100 border=1>"; $FifthImage = "<img src=\"re_images/$im_array[4]\" width=100 height=100 border=1>"; $SixthImage = "<img src=\"re_images/$im_array[5]\" width=100 height=100 border=1>"; } $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>"; $ShowInfo .= "</center></td>\n</tr>";if(!empty($a1[image])) { $im_array = explode("|", $a1[image]); $FirstImage = "<img src=\"re_images/$im_array[0]\" width=100 height=100 border=1>"; $SecondImage = "<img src=\"re_images/$im_array[1]\" width=100 height=100 border=1>"; $ThirdImage = "<img src=\"re_images/$im_array[2]\" width=100 height=100 border=1>"; $FourthImage = "<img src=\"re_images/$im_array[3]\" width=100 height=100 border=1>"; $FifthImage = "<img src=\"re_images/$im_array[4]\" width=100 height=100 border=1>"; $SixthImage = "<img src=\"re_images/$im_array[5]\" width=100 height=100 border=1>"; } $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>"; $ShowInfo .= "</center></td>\n</tr>"; Quote Link to comment https://forums.phpfreaks.com/topic/124820-adding-a-href-to-php-page-to-display-image-from-thumbnail/ Share on other sites More sharing options...
F1Fan Posted September 18, 2008 Share Posted September 18, 2008 You could add an onclick event to each item that runs the javascript window.open function to open you new image window. You can even control its appearance with that function. http://www.w3schools.com/js/tryit.asp?filename=tryjs_openallwindow Quote Link to comment https://forums.phpfreaks.com/topic/124820-adding-a-href-to-php-page-to-display-image-from-thumbnail/#findComment-644829 Share on other sites More sharing options...
JonnoTheDev Posted September 18, 2008 Share Posted September 18, 2008 Remember to escape your quotes " $FirstImage = "<a href=\"biggerimage.php\"><img src=\"re_images/$im_array[0]\" width=100 height=100 border=1></a>"; Quote Link to comment https://forums.phpfreaks.com/topic/124820-adding-a-href-to-php-page-to-display-image-from-thumbnail/#findComment-644830 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.