Handling images...

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
User avatar
arpowers
Forum Commoner
Posts: 76
Joined: Sun Oct 14, 2007 10:05 pm
Location: san diego, ca

Handling images...

Post by arpowers »

Hey everyone,
I have a bunch of questions regarding the CRUD aspect of handling a directory based image system on a site.

Can someone point me to a good resource on this?

for instance:
how do you auto-increment photo id's that your uploading?
what are the security risks?

anyway, any help is always appreciated:)
Andrew
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Handling images...

Post by Christopher »

Do you want a filesystem only implementation, or are you going to use a database to track the images?
(#10850)
User avatar
arpowers
Forum Commoner
Posts: 76
Joined: Sun Oct 14, 2007 10:05 pm
Location: san diego, ca

Re: Handling images...

Post by arpowers »

yes, I will be tying it in with a DB...
AP
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Handling images...

Post by Christopher »

Then you can get the last insert id from the table (or sequence) to use as a unique number.
(#10850)
User avatar
arpowers
Forum Commoner
Posts: 76
Joined: Sun Oct 14, 2007 10:05 pm
Location: san diego, ca

Re: Handling images...

Post by arpowers »

Thanks! ya! that works I guess I didnt think about it that way.....

what are the other concerns in working with directory based content like this?
Ap
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Handling images...

Post by Christopher »

Make sure you use move_uploaded_file() (or whatever it is called) to the filename you generate. File type checking has been covered in these forums, you can search and get good information. It may require multiple calls to identify a file. There is a class around here somewhere that identifies a number of types. And you will need to have some rollback code in case the move or insert does not work.
(#10850)
Post Reply