473,772 Members | 3,148 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with photo album database...

I am building a photo album webpage and am not sure exactly how I
should organize the database. Here's where Im at so far...

I have one table called 'images' which contains the columns 'albumID',
'url', 'title', and 'description'. Then another table called 'albums'
which contains the column 'name'.

The part where I am having the most trouble is the 'images.albumID '
column. Some photos should be placed in mutliple albums, so should the
'albumID' column be an array type?

Also, I would like to have sub-albums within larger albums. So instead
of having a column called 'images.albumID ', should I instead have an
array column called 'images.locatio n' which declares the locations of
where the photo exists? (eg. "Nick's photo album > Vacations > Hawaii"
and "Nick's photo album > Sports > Surfing"). I guess I would also
have to add a 'location' field to the 'albums' table also so they can
be nested.

I would then access the images through JSP/PHP/ASP/etc with ("SELECT *
FROM 'images' WHERE 'location' = albums.location ")

Does anyone have any experience with something like this or know of
the best way to do this??? -Nick
Jul 17 '05 #1
1 3008
Nick wrote:
I am building a photo album webpage and am not sure exactly how I
should organize the database. Here's where Im at so far...

I have one table called 'images' which contains the columns 'albumID',
'url', 'title', and 'description'. Then another table called 'albums'
which contains the column 'name'.

The part where I am having the most trouble is the 'images.albumID '
column. Some photos should be placed in mutliple albums, so should the
'albumID' column be an array type?

Also, I would like to have sub-albums within larger albums. So instead
of having a column called 'images.albumID ', should I instead have an
array column called 'images.locatio n' which declares the locations of
where the photo exists? (eg. "Nick's photo album > Vacations > Hawaii"
and "Nick's photo album > Sports > Surfing"). I guess I would also
have to add a 'location' field to the 'albums' table also so they can
be nested.

I would then access the images through JSP/PHP/ASP/etc with ("SELECT *
FROM 'images' WHERE 'location' = albums.location ")

Does anyone have any experience with something like this or know of
the best way to do this??? -Nick


For the photo album that I created, the database structure looks like this:

CREATE TABLE gallery_index (
category int(10) unsigned NOT NULL default '0',
image int(10) unsigned NOT NULL default '0',
KEY x (category,image )
) TYPE=MyISAM;

CREATE TABLE gallery_images (
id int(11) NOT NULL default '0',
description text NOT NULL,
file varchar(50) NOT NULL default '',
PRIMARY KEY (id)
) TYPE=MyISAM;

CREATE TABLE gallery_categor ies (
id int(11) NOT NULL auto_increment,
name varchar(100) NOT NULL default '',
description text NOT NULL,
num_pics int(11) NOT NULL default '0',
PRIMARY KEY (id)
) TYPE=MyISAM;
I have attached the class definition that I use so you can get an idea
of how this datbase would work.

I only use one category (album) for each image, but to display it in
additional categories, you'd just have to add additional rows to the
gallery_index table - no need for duplicate entries in the other tables.

I really cannot releases any more of the code than this, but hopefully
it's something to get you started with. The class uses MetaBase for
database abstraction, so the SQL may be a little difficult to follow at
first.

HTH

--
Justin Koivisto - sp**@koivi.com
PHP POSTERS: Please use comp.lang.php for PHP related questions,
alt.php* groups are not recommended.

Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2144
by: frizzle | last post by:
Hi there, I've posted the following question elsewhere, but got no response, and there seems to be no special htaccess-group, so i took the liberty to post it here. Hope y'all dont mind. I have a site with a photo album on it. Albums are stored in a MySQL db. I use a site with a standard layout, with
0
1581
by: Nick | last post by:
I am building a photo album webpage and am not sure exactly how I should organize the database. Here's where Im at so far... I have one table called 'images' which contains the columns 'albumID', 'url', 'title', and 'description'. Then another table called 'albums' which contains the column 'name'. The part where I am having the most trouble is the 'images.albumID' column. Some photos should be placed in mutliple albums, so should the...
5
4317
by: fraser | last post by:
Hi, I have a photo gallery with cat photos here http://mouserspage.cjb.net From the beginning, I have been making each page of thumbnails, with a separate page for each photo, entirely in plain html. Since the number of photos I have has increased greatly, it becomes a long and tedious process to go through all the pages to edit the links (to newly added pages) and add in the new pages etc...
5
2063
by: TrvlOrm | last post by:
HI There, I have been struggling with JavaScript code for days now, and this is my last resort! Please help... I am trying to create a JavaScript slide show with links for Next Slide, Previous Slide and Home Slide. Is it possible for you to view my page and tell me what I am doing wrong. I have looked at this page for hours and can't figure it out, I
2
1976
by: Tony WONG | last post by:
i am not sure that this subject can be discussed here. i have many photos. they are stored according to the name of the EVENT and YEAR. i will set up a database (sql or access) to store information of the photo and set up a folder to store the "PHOTOs". and design a web page to show. My question is how to put the photo on the web page.
3
2652
by: Ben Cartwright | last post by:
I'd like to create an ASP.NET-based photo album. Rather than creating a bunch of HTML pages as in a typical photo album, I'd like to leverage the dynamic capabilities of ASP.NET. Any suggestions for getting started, samples, or articles would be greatly apprecated... I'm particularly interested in knowing which controls to use to display the thumbnails and full-sized graphics, and how to display the full-sized graphic when a thumbnail is...
13
4348
by: Viken Karaguesian | last post by:
Hello everyone, Can anyone recommend a good online site to learn PHP? The W3Schools website is quite lacking - leaves much to be desired. I'm sure there are many places, but which ones are good? I currently run a site with an extensive photo gallery. Hundreds of photos. Right now I have a system which the thumbnails are laid out in a table. You click on a thumbnail and you see the full size picture. That full size picture is in its...
2
3175
by: David Griffiths | last post by:
Hi All Using VB 2005 I have been tasked with creating simple Photo Album page on our local intranet server that can display Thumbnails and then the full picture once the thumbnail is clicked in a new window, if the full picture is open I would like to be able to move forward or backwards through the pictures without returning to the thumbnails.
1
1312
by: w33d5 | last post by:
I'm looking for a little help in making an index file to read the subdirectories in the same folder and display the links in a table. i am loading photo galleries using google's picasa onto my host and since picasa exports the albums as folders (I am using a simpleviewer template) i would like to use a script to read the subdirectories in the \photos directory (where the index file would also be located) and display the folders in a clean...
0
9620
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9912
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8934
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5354
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.