Click to See Complete Forum and Search --> : images and mysql


hasmind
08-02-2008, 06:22 AM
Hi, I'm making a website for an architect, who wants to be able to make new project pages easily, without getting into code.

So far, I have made it easy to make a page with the project's description and title, but its not easy to do the same with images.

The architect will want to be able to put from about 4 to 15 images in.

I tried using mySQL as i did for the title and description, but the tables aren't made for the kind of varying amount of images, and the whole process with 'blobs' seems like a waste of time.

Could someone please help me with this, there must be some simple way to do it (Google Images does it well).

thanks

chazzy
08-02-2008, 11:10 AM
i'm not really sure what you're asking, but I think you're really asking two questions:

1. How do I handle varying # of fields for each "project"?
2. How do I store images?

For the first part, you probably want a second table, call it something like "PROJECT_IMAGES" that maybe has fields like:

- project_image_id
- project_id (fk to projects table?)
- image_title
- image_description
- image_location/image_contents (location would be a path where the file is stored, image_contents would be the actual image stored in the DB, you should pick one of these two).

Second, you could go either way. I'd recommend to not store the images in the actual db (which would require a BLOB column) simply for performance. It should be well enough to just store the file on the local file system, and use some kind of replication technique to keep the images in multiple systems (if need be).

You should probably consult some tutorials in the language you're using for the website, as it's not really a "purely sql" type of thing.

hasmind
08-02-2008, 10:44 PM
great, It's nice when the internet actually helps :D

I hadn't thought of making the images in the file system and a database with links to them.

The idea of a different table for images passed through my mind, but I didn't take it anywhere.

thanks