PDA

View Full Version : How to determine the dimensions of a thumbnail?


tgmorris
02-25-2005, 02:49 AM
I'd like to be to figure out what the actual thumbnail dimensions are for some processing purposes. I can obtain the thumbnail - how do I know what the actual width and height are?

deathemperor
02-25-2005, 04:01 AM
use php function getimagesize(), for more info: php.net

tgmorris
02-25-2005, 04:35 AM
use php function getimagesize(), for more info: php.net
I've tried that. The thumbnails are stored in theh DB so to access them it uses attachment.php?attachmentid=41&stc=1&thumb=1. The problem is that it returns the size for the fullsize image and not the thumbnail. Pointing directly to the thumbnail doesn't work.

I can load the thumbnail directly from the DB and did find imagesx and imagesy. These work on in memory images however they come with an error of

Warning: imagesx(): supplied argument is not a valid Image resource

EDIT: Nevermind. I found the solution. I had to use imagecreatefromfile() to create the resource that imagesx uses.

dwh
06-07-2005, 09:15 PM
The funny thing is, when I create a straight php file and run getimagesize on attachments to get size info, it works fine. But put it into vb's task manager causes it to not return width or height. I can't figure out why.