Jump to content

Need ideas for database design for html alt tags


rusty338

Recommended Posts

I'm designing a site that can store photo galleries. So an 'x' number of images will be in a gallery, right now there is not limit, I'm wondering to make this work if I need one. I want for each image to have an alt tag - or even a description, same kind of idea. Now, I'm not really sure how to design a database for this. Should I limit each gallery to have only say 200 images, and in a table only have 200 different fields?

 

Any advice or leads would be greatly appreciated :)

Should I limit each gallery to have only say 200 images, and in a table only have 200 different fields?

 

Why would you limit the gallery to 200 images, and why would it take 200 fields to store 1 image?

 

All you would really need to store are the path to the actual image, the alt , height and width attributes, a description and a few foreign keys relating the image to an owner, and gallery.

have a table with

 

photo_url - the location of the photo

alt_text - the alternitive text to display

userid - the userid of the owner.

 

then when it comes to something like showing all the photos for a user. you can loop through each row that has the users id. use the photo_url to show the photo (src="") and the alt_text to show the alt text in the image tag.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.