![]() |
|
|
|
| ||||||
|
Welcome to the The ProgrammersTalk Community forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
| Tags: cms, image organizer, php |
![]() |
![]() | | LinkBack (1) | Thread Tools | Display Modes | ![]() |
| |
| |||
| I just finished doing something similar to this for a client: Someone that wants to upload images submits the file via a php form. PHP then determines if the image is larger than a specified size, if it is, it is scaled and resampled. The client wants to have all the images IN the database, but I also have to keep a copy in the filesystem to make Flash happy. I store the image id, image title, description, human-readable-file-size, safe filename, image data, and mime-type in the database, and then use the safe filename to call the image from the filesystem for flash. I've also got a script that when passed an ID, regenerates the image from the database. Pulling images from the database is a little confusing at first, so I can help with that. Displaying random images is a cinch, and having an image of the day is also easy. Before anyone asks, calling an image in flash like this doesn't work for me: Code: <img src="image.php?id=9"> |
| The Following User Says Thank You to molotov For This Useful Post: | ||
HelloWorld (08-01-2007) | ||
| ||||
| Thank you monolov, hopefully you can be my mentor when I'm working on this project after my summer school. I'm planning to complete this project 2 weeks at most. BTW, how do you store image in the database? Can I use MySQL to do this? You just store the image "data" in the database right? Or you're literally store the "image" in the database? ![]() |
| ||||
| Best way IMO to store the image is store it in a folder and put path to it in the database, path being "imagefolder/imagename.ext" if you get what i mean? its so much easier and it can be much quicker i believe. (this is how avatars are given to users on forums if you look at the user database, normally in a column called "Avatar" or something on those lines. Hope it helps. |
| The Following User Says Thank You to Lee For This Useful Post: | ||
HelloWorld (08-01-2007) | ||
| |||
| Quote:
Lee is probably correct for your scenario. It depends on how many images you want to store, whether or not they will be on the same server, what file system you're using, etc. If you're on shared hosting, just use the file system, but don't put all the images in the same directory, otherwise after a while, things will get ugly. HelloWorld, the way people store an image is by opening the image file, reading the file contents, and storing that as a BLOB in the database (see file_get_contents(). You need to know what kind of image though the information came from so that you can recreate the image when you need to pull it out of the database, so you'll also probably need to store the mime-type, unless you're restricting it to a single file-type somewhere else in the script (before it's in the database). |
| The Following User Says Thank You to molotov For This Useful Post: | ||
HelloWorld (08-01-2007) | ||
| |||
| Any news on this guys? I'm excited to see progress ![]() __________________ Day Cares | Golf Courses | Disc Golf Courses | Campgrounds | Ice Rinks | Paintball Fields | Dentists | Plastic Surgeons | Aging Jokes Catholic Churches | Lutheran Churches | Methodist Churches | Episcopal Churches | Clean Jokes |
![]() |
| Thread Tools | |
| Display Modes | |
| |
LinkBacks (?)
LinkBack to this Thread: http://www.programmerstalk.net/thread1001.html | |||
| Posted By | For | Type | Date |
| CSULA ACM :: View topic - When should I apply for internships? | This thread | Refback | 08-03-2007 02:46 PM |