Dealing with Pictures

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
Bigun
Forum Contributor
Posts: 237
Joined: Tue Jun 13, 2006 10:50 am

Dealing with Pictures

Post by Bigun »

I started Googling picture functions and all I could read about is the GD library. Problem is that I don't think I have the kind of access required to install the GD library. Therefore, I don't think it would do me a lot of good.

I'm only looking for the ability to detect the size of an dimensions and size of an images, manipulation would be nice if the image falls out of these parameters, but rejection can do for now.

So, can I do these things without the GD library?
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

No. Sorry.

What version of PHP do you have?

You can get the GD Library at: http://www.boutell.com/gd/
Bigun
Forum Contributor
Posts: 237
Joined: Tue Jun 13, 2006 10:50 am

Post by Bigun »

PHP Version 4.4.1 is what the server uses
Bigun
Forum Contributor
Posts: 237
Joined: Tue Jun 13, 2006 10:50 am

Post by Bigun »

PHP version info wrote:GD Support enabled
Goodie
Bigun
Forum Contributor
Posts: 237
Joined: Tue Jun 13, 2006 10:50 am

Post by Bigun »

Ok, it seems I can get the picture attributes just by using the getImageSize, and it doesn't seem to use the GD library.

My next question is this:

Is there a way I can prevent users from uploading anything but pictures, or would I have to use some PHP code to detect that it is an image, and reject it if it isn't?
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

You can't stop them before they upload non-pictures. You can call getimagesize() on every uploaded file & if you get an error, the file isn't an image.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
Post Reply