Page 1 of 1

Should I use mysql to store the user profile picture ?

Posted: Thu May 07, 2009 4:24 am
by aneuryzma
Should I use mysql to store the user profile picture together with other informations ?
Could you suggest me a tutorial to upload the images into the database ?

thanks

Re: Should I use mysql to store the user profile picture ?

Posted: Thu May 07, 2009 4:41 am
by papa
I'd upload the picture on the server and store the path in the database.

Re: Should I use mysql to store the user profile picture ?

Posted: Thu May 07, 2009 4:53 am
by danielwalters6
Keep database size to a minimum - just store the file path!
This way, you can setup to have several images per entry.

Re: Should I use mysql to store the user profile picture ?

Posted: Thu May 07, 2009 6:00 am
by aneuryzma
ok! thanks!

should I pay attention to any security risk ?

Re: Should I use mysql to store the user profile picture ?

Posted: Thu May 07, 2009 6:02 am
by papa
If you want users to upload their own picture you need to do some limitations in size and file type for example.

Re: Should I use mysql to store the user profile picture ?

Posted: Thu May 07, 2009 6:29 am
by aneuryzma
ok, I'm already limiting the size.

How can I limit the type ? Just checking for extension ?

Re: Should I use mysql to store the user profile picture ?

Posted: Thu May 07, 2009 6:38 am
by mickd
Maybe with a function like exif_imagetype. Though i haven't used it myself.

I would assume you wouldn't want to just check the file extension because it could even be an executable, but with its extension changed.

Re: Should I use mysql to store the user profile picture ?

Posted: Thu May 07, 2009 9:55 am
by pickle
getimagesize() can give you the file type.