Solved

general advice need with storing pictures

Posted on 2004-03-31
5
210 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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Suggested Solutions

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 …
Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

785 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