Forum Moderators: coopster
the interesting thing is that the image name and image size fields display the correct information. just no image in the image field. and the image javascript code works fine too...
using php 5+
gd 2+ is enabled
plz help.
<div align="center">Click on an image to view it in a separate window.</div><br />
<table align="center" cellspacing="5" cellpadding="5" border="1">
<tr>
<td align="center"><b>Image</b></td>
<td align="center"><b>Image Name</b></td>
<td align="center"><b>Image Size</b></td>
</tr>
<?php # images.php$dir = 'uploads';
$files = scandir($dir);
foreach ($files as $image) {
if (substr($image, 0, 1) != '.') {
$image_size = getimagesize("$dir/$image");
$file_size = round ( (filesize ("$dir/$image")) / 1024) . "kb";
>>>line 27>>> $display = imagecreatefromjpeg($image); // Read all the images into an array.
echo "<tr>
<td>$display</td>
<td><a href=\"javascript: create_window('$image',$image_size[0],$image_size[1])\">$image</a></td>
<td>$file_size</td>
</tr>";
}
}
?>
</table>
$file_size = round ( (filesize ("$dir/$image")) / 1024) . "kb";
>>>line 27>>> $display = imagecreatefromjpeg($image); // Read all the images into an array.
The first thing I'm seeing is you're requesting the information for the image size and file size and actual image from two different locations...
$image_size and $file_size come from here: $dir/$image
$display comes from here: $image (no $dir included.)
My guess is it's a path issue, and $dir/$image will probably correct it since the other's are getting you the information...
$display = imagecreatefromjpeg($dir/$image);
If not, double check on the path you are using to the actual image. I would definitely use a server relative path (/begins-with-a/slash) rather than directory relative (does-not-begin-with-a/slash) since you are using a pop-up.
i tried setting the path and the methods that seems to almost work are either of these two:
$display = imagecreatefromjpeg("$dir/$image");
$display = imagecreatefromjpeg("./$dir/$image");
the error goes away, but now i get a message in the image boxes:
Resource id #12
Resource id #15
Resource id #18
Resource id #21
there are four images in the uploads dir.
thank you for getting me this far. i appreciate all the help.