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

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
danselstudios
Forum Newbie
Posts: 24
Joined: Sat Jun 03, 2006 10:47 am
Location: Corona, CA

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

Post 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???
User avatar
Zoxive
Forum Regular
Posts: 974
Joined: Fri Apr 01, 2005 4:37 pm
Location: Bay City, Michigan

Post by Zoxive »

var_dump(gd_info());

Do you have GD?

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

-NSF
danselstudios
Forum Newbie
Posts: 24
Joined: Sat Jun 03, 2006 10:47 am
Location: Corona, CA

Post 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????
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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'].
Post Reply