Page 1 of 1

?width?With this form I upload image to dir & put data t

Posted: Wed Sep 13, 2006 10:18 pm
by danselstudios
So i'm uploading images and inserting image name and image location to MySQL database...

I looking for ways to read the image's WIDTH and inserting that number into another field on the database

how do i do this?

currently i'm using $_FILES['image'] to read its name and the form uses the POST method. I tried using imagesx(), but it doesn't work.

any help???

Posted: Wed Sep 13, 2006 10:25 pm
by Zoxive
var_dump(gd_info());

Do you have GD?

imagesx(); should do it for ya...

-NSF

Posted: Wed Sep 13, 2006 10:44 pm
by danselstudios
yeah I sure do have GD...version 24 to be exact...
thanks for that gd_info() function...neeto.


Warning: imagesx(): supplied argument is not a valid Image resource in c:..\cpanel\ns_gallery_config.php on line 81

$image_width = imagesx($_FILES['img_file']); <---this is the supplied argument...whats wrong with this????

Posted: Thu Sep 14, 2006 8:04 pm
by feyd
That's an array. imagesx() specifically says the argument is to be a resource.

I believe you may want to use getimagesize() instead. .. and it'd be $_FILES['img_file']['tmp_name'].