Solved

general advice need with storing pictures

Posted on 2004-03-31
5
208 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
Comment Utility
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
Comment Utility
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
Comment Utility
is that not just what i said? but in less words
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Wordpress Query 1 30
Use PHP to save or display image returned by JSON call. 20 44
creating 2 user ID's 5 24
php documentation 4 19
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
This article discusses four methods for overlaying images in a container on a web page
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

762 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

7 Experts available now in Live!

Get 1:1 Help Now