Link to home
Start Free TrialLog in
Avatar of irishprogrammer
irishprogrammer

asked on

general advice need with storing pictures

Hi,
I am going a website, for a real estate company. So, each property they have listed on the site, will have a number of pictures for the property. Properties will be deleted from time to time, and added from time to time. I'l like my pages to be dynamic, but i wont always know the names of the files produced , i'm using a mysql back end, and php to generate my html, can anybody give me gernal advice to make this is easy as possible????? i will be writing scripts for the admin of the site also..... there's a lot of points on offer for this, so best overall or even source wins!!!!!

many thanks
ASKER CERTIFIED SOLUTION
Avatar of jkna_gunn
jkna_gunn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of halexic
halexic

Fine example that is working you can see at http://www.kvadrati.com/ 
I store picture file names and picture captions in "image" sql table. Picture files (GIF, JPG) I store in one directory on my website (I have made it).
In my PHP file that has settings for my website I have defined a path to that directory.

Example:
define("UPLOAD_DIRECTORY","http://www.yoursite.com/pictures/");

When you uploading picture real file goes to this directory and name of the picture goes to "image" SQL table in "filename" column and picture caption's (some free text as picture description) goes to "caption" column.
I make small modification to original picture filename (before saving it to database) by adding unique image "id" as prefix (this is primary key "id" of "image" SQL table).

Example:
If your original picture name is "house.jpg", I first find the next primary key in "image" table - suppose I have found that it is "236" and than I store this picture name in "image" table as "236_house.jpg" so you will always have a unique picture name in database... I also save real picture file with this modified name in my picture folder...

Hope this help
is that not just what i said? but in less words