hi, my first post here
so i am having a problem in this line of code...
Code:
$display = imagecreatefromjpeg("$dir/$image"); // Read all the images into an array.
in the display cell it doesnt display the image. it gives me "Resource id #12".
the file name and file size cells display the correct info and the javascript displays the correct image...
what am i doing wrong?
i am using php 5+ and gd 2+ is enabled.
thanks. full code follows.
Code:
<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
// This script lists the images in the uploads directory.
$dir = 'uploads'; // Define the directory to view.
$files = scandir($dir); // Read all the images into an array.
// Display each image caption as a link to the JavaScript function.
foreach ($files as $image) {
if (substr($image, 0, 1) != '.') { // Ignore anything starting with a period.
// Get the image's size in pixels.
$image_size = getimagesize("$dir/$image");
// Calculate the image's size in kilobytes.
$file_size = round ( (filesize ("$dir/$image")) / 1024) . "kb";
// display gif
$display = imagecreatefromjpeg("$dir/$image"); // Read all the images into an array.
// Print the information.
echo "<tr>
<td>$display</td>
<td><a href=\"javascript: create_window('$dir/$image',$image_size[0],$image_size[1])\">$image</a></td>
<td>$file_size</td>
</tr>";
} // End of the IF.
} // End of the foreach loop.
?>
</table>
__________________
newbie
php 5+, mysql 5+, apache 1.33
|