Hello, this is small php gallery code which generates thumbnails of an images and when clicked on Thumbnail bigger image is displayed.
Now i want to add some Function which will open an image in a popup window with no Scrolbars, Adress bar, etc… and having fixed size (500,500) and i did something like this:
[code=php]
<BR>
<table align=”center” border=”0″ cellpadding=”0″ cellspacing=”0″ width=”530″ height=”50″>
<TR><TD height=”50″><img src=”images/gallery_ge_pgtitle.jpg”></TD></TR>
</table>
<?php
function createThumbs( $pathToImages, $pathToThumbs, $thumbWidth )
{
$dir = opendir( $pathToImages );
while (false !== ($fname = readdir( $dir ))) {
$info = pathinfo($pathToImages . $fname);
if ( strtolower($info[‘extension’]) == ‘jpg’ )
{
$img = imagecreatefromjpeg( “{$pathToImages}{$fname}” );
$width = imagesx( $img );
$height = imagesy( $img );
$new_width = $thumbWidth;
$new_height = floor( $height * ( $thumbWidth / $width ) );
$tmp_img = imagecreatetruecolor( $new_width, $new_height );
imagecopyresized( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height );
imagejpeg( $tmp_img, “{$pathToThumbs}{$fname}” );
}
}
closedir( $dir );
}
createThumbs(“images/upload/”,”images/upload/thumbs/”,100);
function createGallery( $pathToImages, $pathToThumbs )
{
$output .= “<table border=”0″ cellspacing=”4″ align=”center” cellpadding=”12″ width=”500″>”;
$output .= “<tr>”;
$dir = opendir( $pathToThumbs );
$counter = 0;
while (false !== ($fname = readdir($dir)))
{
if ($fname != ‘.’ && $fname != ‘..’)
{
$output .= “<td style=”border-top:1px #CCCCCC solid; border-bottom:1px #CCCCCC solid; border-left:1px #CCCCCC solid; border-right:1px #CCCCCC solid;” valign=”middle” align=”center”><a href=”JavaScript:window.open(‘{$pathToImages}{$fname}’, ‘mywindow’, ‘toolbar=no, width=500, height=500’ return false);”>”;
$output .= “<img src=”{$pathToThumbs}{$fname}” border=”0″ />”;
$output .= “</a></td>”;
$counter += 1;
if ( $counter % 4 == 0 ) { $output .= “</tr><tr>”; }
}
}
closedir( $dir );
$output .= “</tr>”;
$output .= “</table>”;
print “$output”;
}
createGallery(“images/upload/”,”images/upload/thumbs/”);
?>
You Will see that URL looks Like this :
[CODE]$output .= “<td style=”border-top:1px #CCCCCC solid; border-bottom:1px #CCCCCC solid; border-left:1px #CCCCCC solid; border-right:1px #CCCCCC solid;” valign=”middle” align=”center”><a href=”javascript:window.open(‘{$pathToImages}{$fname}’, ‘mywindow’, ‘toolbar=no, width=500, height=500’ return false);”>”;
$output .= “<img src=”{$pathToThumbs}{$fname}” border=”0″ />”;
$output .= “</a></td>”;
and it gives me error, no popup window appears
Thanks.