I've always used pretty much the exact same setup as far as  a database
table to hold image information goes...

ImageID (PK autonumber for story images and just Number for an image
gallery)
CatID     (category id for different categories in image galleries)
Image     (Filename)
Iheight    (Normal Image Height)
Iwidth    (Normal Image Width
Theight   (Thumb image height)
Twidth    (Theumb Image Width)
Cutline    (Cutline text to be displayed with the images)
Sortid     (order of the images [pretty much just for an image gallery but i
put it in all image tables anyway for reuse of code])

When I'm doing an image gallery I rename the image according to the new
imageID (and a categoryID if applicable) since theres no need for a drop
down list of image names in the admin tools
so the new images name would be like #categoryID##imageID#.jpg (108.jpg)

On image galleries. when a new category is added a create a new directory
from the new categories PKID then images uploaded to that category go in
that directory so the image above (108.jpg)
would be located in images/gallery/10/108.jpg

You never have to worry about bad characters in image names, no need to
upload to a temp directory for conflict checks since its a unique name no
matter what directory it goes in

Now images that are uploaded for display in stories like news or whatever
are a little different, the admins need to know what the image name is so
they can choose it from a drop down list when adding/editing a story so I've
always stripped out characters that didnt need to be there when renaming the
images but then you may very well run into a cases where you rename a new
image to an image name that already exists then the client flips out and
starts adding all kinds of even stranger characters to it trying to get it
to upload and it happens all over again then they call you and you try to
explain all this to them and the conversation carries over into your lunch
break and you can't keep yourself from glancing over at the clock and
THINKING how you want to kill the person on the other end of the line while
still SAYING what needs to be said then you get confused and THINK "Yes sir,
We'll look into that" but you SAY "I'm going to come to your house and kill
you" then you get fired over it and can't find another job so you end up in
prison for robbing liquor stores for rent money...over what? an image name?

oh sorry....back to the topic....

So I've changed my database design a little and its constant for any table
that holds image information throughout an application..

ImageID  (PK Number)
CatID     (category id for different categories in image galleries)
Image      (Filename)
Original   (Original File name)
Iheight     (Normal Image Height)
Iwidth     (Normal Image Width
Theight    (Thumb image height)
Twidth    (Theumb Image Width)
Cutline    (Cutline text to be displayed with the images)
Sortid     (order of the images [pretty much just for an image gallery but i
put it in all image tables anyway for reuse of code])

so now I can rename ANY image to a safe little 123.jpg format and still
display the original image name in a drop down list for the client to select
from and the image upload/resize code is that much easier to reuse (good
thinking me)

Just figured I'd share all this. plus when I forget what I said, I can look
in the HOF archives heh

~Ewok~





~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Signup for the Fusion Authority news alert and keep up with the latest news in 
ColdFusion and related topics. 
http://www.fusionauthority.com/signup.cfm

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to