General SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesGeneral SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old August 15th, 2003, 01:55 PM
wastedbreath wastedbreath is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: BC, Canada
Posts: 35 wastedbreath User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to wastedbreath
Properties for image gallery

On my personal site I am creating an image gallery script. Here is the table I want to create ..except for the row where the image will be uploaded. Could someone help me out with that? Image won't be bigger than 1280x1024.

Code:
CREATE TABLE gallery   (
id INT (1) not null AUTO_INCREMENT,
title VARCHAR (50),
date DATE
-----image properties here----
PRIMARY KEY (id)
);


Thanks

Reply With Quote
  #2  
Old August 15th, 2003, 03:57 PM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
Re: Properties for image gallery

Code:
CREATE TABLE gallery   (
id INT (1) not null AUTO_INCREMENT,
title VARCHAR (50),
date DATE
-----image properties here----
PRIMARY KEY (id)
);

1. Your id field should probably be larger.
2. the field you want to add could be something like -
filename varchar (255)
All you need is the name... you don't want to to hardcode a path into your field name... alternatively you can add a path field as well.
path varchar (255)


For example, a record in this database would have the following in filename: testphoto.jpg

In path you might have: /album/photos/album1/
__________________
__________________________________________________ _
Wil Moore III, MCP | Integrations Specialist | Senior Consultant
Are You Listed...? | DigitallySmooth Inc.

Reply With Quote
  #3  
Old August 15th, 2003, 05:19 PM
wastedbreath wastedbreath is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: BC, Canada
Posts: 35 wastedbreath User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to wastedbreath
Code:
CREATE TABLE gallery   (
id INT (11) not null AUTO_INCREMENT,
title VARCHAR (50),
date DATE,
img VARCHAR (255),
path VARCHAR (40),
PRIMARY KEY (id)
);


Like that?

Reply With Quote
  #4  
Old August 15th, 2003, 05:34 PM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
Try this:
Code:
CREATE TABLE gallery   (
id INT (11) not null AUTO_INCREMENT,
title VARCHAR (50),
stamp timestamp,
added timestamp,
img VARCHAR (255),
path VARCHAR (255),
PRIMARY KEY (id)
);
No need to limit your path to 40... you will just end up altering your table later and increasing the length... trust me. You are not saving a ton of space by making this limit either. If you were to get to about half/million records in the table at that point you could evaluate how much space you were wasting then trim the fat... at this point there is no gain in doing so.

Since you are using mysql you may as well utilize the timestamp field type. The first stamp will be filled with the current time when you first insert the row (don't insert to this field in your insert statement... it will autofill). This setup has the added benefit of having your stamp field get updated with the current time that you modified the record (if you do an update on the field stamp will be updated automatically since it is the first timestamp in the table). The second timestamp (added) will always have the original date/time.

Reply With Quote
  #5  
Old August 15th, 2003, 05:36 PM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
You also might want to create an index on img (for searching), and you should probably do a unique key on path+img (for no dupes)

Reply With Quote
  #6  
Old August 15th, 2003, 06:18 PM
wastedbreath wastedbreath is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: BC, Canada
Posts: 35 wastedbreath User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Send a message via AIM to wastedbreath
Alright, sweet. Learned a couple new things there. THanks!

Reply With Quote
  #7  
Old August 15th, 2003, 10:52 PM
laidbak laidbak is offline
you know how we do
Dev Articles Novice (500 - 999 posts)
 
Join Date: Jun 2002
Location: In Tha IE -- San Bernardino COUNTY
Posts: 788 laidbak User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 4 m 2 sec
Reputation Power: 7
Send a message via ICQ to laidbak Send a message via AIM to laidbak Send a message via MSN to laidbak Send a message via Yahoo to laidbak
Glad to help as always...

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesGeneral SQL Development > Properties for image gallery


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway