image database - best way?

greg's picture

He has: 1,581 posts

Joined: Nov 2005

howdy

whats the best way for storing & displaying pictures for an estate agent site?

There will be around 300-400 pictures.
3 houses per page each with one pic (about 20 pages per property type) .
Then each house linking to their own individual page with 3 more pics.

With the main requirement being easy deletion of pictures and reference of pictures in the database when houses are sold - this will be frequent.

Also how do i avoid having to manually edit php to delete the sold house from the page, and reshuffle them to fit the remaining houses?

I'm not particularly wanting a tutorial (there are plenty of those around) just pointing in the right direction!!

thanks a lot

Busy's picture

He has: 6,151 posts

Joined: May 2001

You could download a program like coppermine or similar, or if you wanted could create your own database.

If you created your own you could set the db up something like
lot_num
date_entered
date_sold
sales_person
price
house_type
location
description
pic_1
pic_2
pic_3
pic_4

I'm guessing you have agents, if so then another table with the agents details, such as name, phone, sex or whatever.

To just display 3 on a page you limit the database query to 3, can count up all the ones that have not been sold (or all of them) and thats your navigation sorted and can search by price, location, agent, size.

With a database you dont have to manually edit any pages, you just select which ones you want with the query, like; select * from realestate where sold == '' which would display all the unsold ones.
To make them sold or unsold you just have an admin page (a form) where you enter the lot number and it brings up the details and you can edit, or mark as sold.

The pictures themselves can be uploaded via a form that has all the other details of each house, using PHP's GD or imagemavick you can create the thumbnails of these at the same time. Ideally you should keep the details for several months (if not years) for tax and other regulations, but come delete time you just prune the database by sold date, kinda like; if date_sold is more than x months from todays date then remove from database and unlink (remove) the images.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.