vetman Posted May 12, 2008 Share Posted May 12, 2008 I have a script that reads a directory of pictures, makes thumbnails of the pictures. It then show them in the broser. When I click the picture it shows the larger picture in the broser. I want to pop-up another window with the picture in it. I have a javascript file that does that, but I can't figure out how to make it work with this script. Listed below is my attempt, not show all the script: function getNormalImage($file){ $base = substr($file,0,strrpos($file,'_th.jpg')); if (file_exists($base.'.jpg')) return $base.'.jpg'; elseif (file_exists($base.'.jpeg')) return $base.'.jpeg'; else return ""; } function displayPhotos(){ global $columns; generateThumbnails(); $act = 0; // Open the actual directory if ($handle = opendir(".")) { // Read all file from the actual directory while ($file = readdir($handle)) { // Check whether tha actual item is a valid file if (is_file($file)){ // Check whether the actual image is a thumbnail if (strpos($file,'_th.jpg')){ ++$act; if ($act > $columns) { echo '</tr><tr> <td class="photo"><a href="'.getNormalImage($file).'" onClick='return showpic("'.getNormalImage($file).'",,);'><img src="'.$file.'" alt="'.$file.'"/></a></td>'; $act = 1; } else { echo '<td class="photo"><a href="'.getNormalImage($file).'"> <img src="'.$file.'" alt="'.$file.'"/></a></td>'; } } } } } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "DTD/xhtml1-transitional.dtd"> <html> <head> <title>Photo Gallery</title> <script language="javascript"> function showpic(picurl,width,height) { picwindow = window.open('', 'pic', 'resizable,height=' + (height+70) + ',width=' + (width+20)); picwindow.document.write('<HTML><BODY bgcolor="66cc99">\n'); picwindow.document.write('<TABLE border=0 cellpadding=0 cellspacing=0>\n'); picwindow.document.write('<TR><TD><IMG SRC="' + picurl + '" WIDTH=' + width + ' HEIGHT=' + height + ' BORDER=0></TD></TR>\n'); picwindow.document.write('</TABLE>\n'); picwindow.document.write('<br><center><A href="javascript:self.close()"><B>Close Window</B></A></center>\n'); picwindow.document.write('</BODY></HTML>\n'); return false; } // If we are on NetScape, we can bring the window to the front if (navigator.appName.substring(0, == "Netscape") picwindow.focus(); </script> </head> <body> <center><h3>Photo Gallery</h3></center> <table align="center"><tr> <?php displayPhotos(); ?> </table> </body> </html> Any help or direction would be appreciated. Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/105345-solved-i-need-some-help-with-a-pop-up-window-for-pictures/ Share on other sites More sharing options...
vetman Posted May 13, 2008 Author Share Posted May 13, 2008 Okay! What's the problem? 69 views but no responses or comments. Thanks Link to comment https://forums.phpfreaks.com/topic/105345-solved-i-need-some-help-with-a-pop-up-window-for-pictures/#findComment-539954 Share on other sites More sharing options...
soycharliente Posted May 13, 2008 Share Posted May 13, 2008 Are you asking for Javascript help? This is a PHP room. Try the one for Javascript. Link to comment https://forums.phpfreaks.com/topic/105345-solved-i-need-some-help-with-a-pop-up-window-for-pictures/#findComment-539956 Share on other sites More sharing options...
vetman Posted May 13, 2008 Author Share Posted May 13, 2008 Sorry, they moved it here! I posted it there I think. Thanks Link to comment https://forums.phpfreaks.com/topic/105345-solved-i-need-some-help-with-a-pop-up-window-for-pictures/#findComment-539961 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.