Home arrow MySQL arrow Page 6 - Online Photo Album Development using PHP and GD: Part 1

Conclusion - MySQL

This article is the first part of a four part series about saving money and space when it comes to showing off your pictures. Frank will be using PHP, MySQL and GD in this series.

TABLE OF CONTENTS:
  1. Online Photo Album Development using PHP and GD: Part 1
  2. Photo Sizing
  3. Photo Class
  4. To Gif or Not to Gif
  5. Resizing Images
  6. Conclusion
By: Frank Manno
Rating: starstarstarstarstar / 36
April 22, 2004

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement
Database Snapshots

We need to create our database structure. We have many options available to us regarding how we want our images to be organized. I've chosen to go with creating multiple albums, containing multiple images. This will allow for a well-organized gallery, in that we can group related albums together.

Our database structure will contain the following tables:

Table Name: album

Table Name: photo

We'll now create our tables using MySQL:

CREATE TABLE album (
album_id int(11) NOT NULL auto_increment,
album_name varchar(255) NOT NULL default '',
album_desc text NOT NULL,
album_cover varchar(255) NOT NULL default '',
PRIMARY KEY (album_id),
KEY album_name (album_name)
) TYPE=MyISAM;

CREATE TABLE photo (
photo_id int(11) NOT NULL auto_increment,
photo_title varchar(255) NOT NULL default '',
photo_desc text NOT NULL,
photo_date datetime NOT NULL default '0000-00-00 00:00:00',
photo_location varchar(255) NOT NULL default '',
thumbnail_location varchar(255) NOT NULL default '',
album_id int(11) NOT NULL default '0',
PRIMARY KEY (photo_id),
KEY photo_title (photo_title),
) TYPE=MyISAM;

An example INSERT query may be something like the following:

INSERT INTO album VALUES(0, 'Frank's Birthday', 'May contain incriminating photos! :)', 'thumbs/at_the_bar_080103_180743');

INSERT INTO photo VALUES(0, '1st Drink of Many', 'A Drink with Friends!', '2003-08-03 18:07:43', 'photos/ at_the_bar_080103_180743', 'thumbs/ at_the_bar_080103_180743'', 1);

Now that our tables have been created, we can worry about the structure of our "back-end interface", which will allow us to upload our images into the chosen album(s).



 
 
>>> More MySQL Articles          >>> More By Frank Manno
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

MYSQL ARTICLES

- Oracle Unveils MySQL 5.6
- MySQL Vulnerabilities Threaten Databases
- MySQL Cloud Options Expand with Google Cloud...
- MySQL 5.6 Prepped to Handle Demanding Web Use
- ScaleBase Service Virtualizes MySQL Databases
- Oracle Unveils MySQL Conversion Tools
- Akiban Opens Database Software for MySQL Use...
- Oracle Fixes MySQL Bug
- MySQL Databases Vulnerable to Password Hack
- MySQL: Overview of the ALTER TABLE Statement
- MySQL: How to Use the GRANT Statement
- MySQL: Creating, Listing, and Removing Datab...
- MySQL: Create, Show, and Describe Database T...
- MySQL Data and Table Types
- McAfee Releases Audit Plugin for MySQL Users

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: