Solved

general advice need with storing pictures

Posted on 2004-03-31
5
209 Views
Last Modified: 2012-05-04
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
0
Comment
Question by:irishprogrammer
  • 2
5 Comments
 
LVL 6

Accepted Solution

by:
jkna_gunn earned 400 total points
ID: 10722746
i would upload the pictures and store them in a directory of your choosing. when they are uploaded you can dynamically rename the pictures if you want, if not you can use the name of the file that was uploaded, so the path to the directory where you store the images plus the name of the picture will be stored in the DB.
0
 

Expert Comment

by:halexic
ID: 10730215
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
0
 
LVL 6

Expert Comment

by:jkna_gunn
ID: 10730333
is that not just what i said? but in less words
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

919 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now