Having trouble with getimagesize from a recordset

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
vcarter
Forum Newbie
Posts: 14
Joined: Sun Jun 21, 2009 3:02 pm

Having trouble with getimagesize from a recordset

Post by vcarter »

I am trying to use getimagesize from images in a table. This is what I'm doing:

Code: Select all

<?php
$image=$row_Recordset1['image']; //image name from the table
$imagePath="_img/gallery/thumbs/"; //path to image
$filename=$imagePath.$image; //concatenate path and image name
$imageInfo=getimagesize($filename);
echo $image."<br><br>"; // testing image name
echo $filename."<br><br>"; // testing full path to image
print_r($imageInfo);
echo file_exists($filename)?"Exists":"Doesn't exist"; echo "<br><br>";
?>
$image displays the proper image name...
$filename displays the proper path to the image...
I can display the image using either of the above variables...

ie:

Code: Select all

<img src="<?php echo $filename ?>" /><br /><br />
<img src="_img/gallery/thumbs/<?php echo $row_Recordset1['image']; ?>" width="263" height="175" alt="" />
However, I get "Doesn't exist" when testing if the file exists, and I'm unable to get the information from getimagesize.

Any ideas?
Post Reply