Forum Moderators: coopster
1) using a mysql database to look up an image name from an ID and displaying the found image by accessing its location on the fileserver without opening the image and displaying it thru php. (Just redirecting the browser to the image)
mysql table:
¦int:ID¦char:Name¦
2) using a mysql database to look up an image from an ID and displaying that image thru the PHP functions (or maybe just sending a binary file)
mysql table:
¦int:ID¦medblob:Content¦
I have heard some statistics that storing the image in a mysql database is actually faster by 1 second per 1000 images, but I figured it is always better to have a second opinion.
Also, about putting the file into the database, I would have to put the location in the database anyway, so 3-4 more lines of code reading in the file?
I am mainly interested in the performance side of this problem.
eg.
/photos/large/123.jpg
/photos/small/123.jpg
/photos/thumb/123.jpg
If you need to preserve the filename/filetype then store that information in the database and use a passthru command.
There's no way I would consider storing images actually in the database. Just considering how many ways that could go wrong gives me a headache ;)
I would have thought that it would be less processor intensive to call the file rather than have to render it from the database. Why don't you carry out some tests?
I remember that a friend of mine - a few years ago now - was storing his images in MySql db, but swapped over to files because the strain was too much for his server to handle. However, MySql has come on since then.
The method I use is to name the image files based on the database id.
eg. /photos/large/123.jpg /photos/small/123.jpg /photos/thumb/123.jpgzRonin, just to say that you better use unique-encoded id instead of incremented the value.
Why?
zRonin, just to say that you better use unique-encoded id instead of incremented the value.
Sorry about the double post, but he didnt post until after I started mine and I cant edit.
Good idea. I can add some sort of timestamp to each file like I did for another project. (i.e. name[timestamp%1000].ext)