cljones81 Posted March 29, 2008 Share Posted March 29, 2008 Hi I have written a simple php script that outputs a thumbnail version of pics with information from a mysql database which when the user clicks the smaller image, a larger image is opened in a new window. My problem is I would like to have an automatically generated button below the bigger image that returns the viewer back to the previous page of thumbnail images. Could someone please help me as I haven't the first clue how to do this and cannot find any tutorials. Thank you in advance Christian Quote Link to comment Share on other sites More sharing options...
AndyB Posted March 29, 2008 Share Posted March 29, 2008 If the large image opens in a new window, all you need is a 'close window' button rather than a back to thumbnails link ... <a href='javascript:window.close()'>Close Window</a> Quote Link to comment Share on other sites More sharing options...
cljones81 Posted March 29, 2008 Author Share Posted March 29, 2008 Thank you for the reply, Im a bit confused, maybe its the affect of a long day finally catching up on me but could you please explain more fully: here is my code: while ($row = mysql_fetch_array($result, MYSQL_ASSOC)){ $id = $row["id"]; $description = $row["description"]; $category = $row["category"]; $dateuploaded = $row["dateuploaded"]; $url = $row['link']; $uploader = $row["uploaderid"]; $compurl = "<a href='$url'><img src='$url' alt='Click me for a larger image' width='80' height='81' border='0' /></a>"; $texturl = "<a href='$url' target='_blank'>Larger Image</a>"; echo "<table width='382' border='1' bordercolor='#F8F0F8' bgcolor='#0000FF' class='whiteonbluelink'> <tr> <th colspan='2' scope='col'><div align='left' class='style3'>$id $url uploaded by $uploader on the $dateuploaded </div></th> </tr> <tr> <td width='93'><span class='style5'>$compurl<br> $texturl</span></td> <td width='273'><span class='style5'>$description</span></td> </tr> <tr> <td colspan='2'><div align='center' class='style5'>Category: $category </div></td> </tr> </table> <br>"; } How could I incorporate your code into $compurl so that the javascript close window link is in the same window as the newly opened image. Sorry for my ignorance but didnt someone once say that the path to wisdom starts with the words I dont know, maybe it was me. Thank you again Christian Quote Link to comment Share on other sites More sharing options...
colombian Posted March 29, 2008 Share Posted March 29, 2008 Is the new url just a link to the image? Meaning "url_etc/image-name.jpg" If it's an image like that, then you need to output the image in a new page, not a link to the image itself. Make the larger image open in a random php page that will host all those image. Once you have that page, you just put the code suggested in it, and it doesn't even need to change, since it's just closing that window. So the new page say "images.php" Would be something like: <?php // Use GET to grab image information $image = $_GET['Insert-Image-URL-Here']; echo $image; echo "<br /> <a href='javascript:window.close()'>Close Window</a>"; ?> Quote Link to comment Share on other sites More sharing options...
cljones81 Posted March 29, 2008 Author Share Posted March 29, 2008 I wish to sincerely thank colombian and AndyB for their patience and kind help to an idiot who was having a major off day. Once again thank you Christian Quote Link to comment 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.