Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getimagesize on images pulled from mysql

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello, first of all, please let me briefly explain the problem I'm facing:

Basically I've stored some images in MySQL database and, I would like to pull those images out together with their width and height. In my confusion,I thought I can use getimagesize function to get it worked:

..........
.........
while($i=mysql_fetch_array($result)){
$wh=getimagesize("$i['image']");
print("Width=wh[0] Height=$wh[1]");
........


And,here's the error I've got:

Warning: getimagesize: Unable to open '??? for reading

Actually I have an alternative way which is to store the width and height of an image into database before uploading it ,yet I hope I could get those info dynamically.

I think the main problem is that php doesn't recognize $i['image'] as an image file since it's stored as 'blob'

It really drives me crazy.I've been working for a couple days on this stuff.

I hope someone could maybe help me figure out why. Thank you very much.
 
When you upload the image you gan get alot of info about it dynamically , store all the info at this point.
if (is_uploaded_file($HTTP_POST_FILES['userfile']['tmp_name'])) {

echo &quot;Temp name: $userfile <br>
Name: $userfile_name <br>
Size (Bytes): $userfile_size<br>
type: $userfile_type <br>
Dimensions:&quot;;
$dimensions=GetImageSize($userfile);
echo &quot;$dimensions[0] x $dimensions[1]<br>&quot;;
} ***************************************
Party on, dudes!
[cannon]
 
I've been working on storing images in a database for my site ( My solution was the use
Code:
getimagesize()
and find the image dimentions to store them as fields in the record because it's difficult to do much with it once it's stored.

Look at my site, see what you think. If you'd like some examples of my code, just let me know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top