Click to See Complete Forum and Search --> : mysql database?


lukeurtnowski
07-09-2006, 02:47 PM
I was trying to follow the tutorial for creating an image database
http://codewalkers.com/tutorials/35/3.html
but am sort of confused. Does this database make sure the type of each image is; gif, jpg, png, or bmp? (how can I do that)
Also I want to limit the file size of the image to about 10-20K and limit its width to about 300px.
Lastly I would like to figure out a way to edit/delete images (made of course so it can only be done by me (password protected?))

thoughtcube
07-10-2006, 03:24 AM
The database stores the images as binary blobs, it has no idea what's in there. When you read it, you need to make sure you read it in the right format (the same as you wrote).

The simplest way to limit the size is simply to not write anything that is too big to the database. If you set up things in the database so the size is limited, you will get an error if you try to write anything larger. So anyhow you will need to make sure about what you write.

aussie girl
07-10-2006, 06:00 AM
Go into the PHP thread and read the sticky about uploading images. Secondly I don't put images into a database only the name of the image and upload the image to the server, then use a scripting with the pathway to the image to view it.