Go Back   CodingForums.com > :: Server side development > MySQL

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 04-27-2012, 01:19 AM   PM User | #1
DazednConfused
New Coder

 
Join Date: Dec 2011
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
DazednConfused is an unknown quantity at this point
Attach thumbnails to Database in MySQL

I am making an inventory database with MySQL for our small car lot. Basically what I want to do, is have rows in a scrollable box(this I know how to do). But I want to be able to link a thumbnail to a certain row in the SQL table. This way in a row that is probably 1000 pixels wide, you will see a thumbnail on the left side of the row, then the info taken from the table that links to that specific car.
I am new to mySQL and have been googling my problems. I know there is a method for this, but I am wondering if someone can point me in the right direction or help me out. Thank you for taking the time to read my question!
DazednConfused is offline   Reply With Quote
Old 04-27-2012, 01:34 AM   PM User | #2
DazednConfused
New Coder

 
Join Date: Dec 2011
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
DazednConfused is an unknown quantity at this point
I like easy, and I understand what your saying. Im going to set up some rows and give that method a try, thank you
DazednConfused is offline   Reply With Quote
Old 04-27-2012, 01:44 AM   PM User | #3
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,162
Thanks: 59
Thanked 3,992 Times in 3,961 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
You *can* store images in the database. And there are occasionally good and solid reasons to do so. But mostly they involve situations where you have hundreds of thousands of images and your web site is so busy that you have replicated servers for your web server and/or database server.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Old 04-27-2012, 01:53 AM   PM User | #4
DazednConfused
New Coder

 
Join Date: Dec 2011
Posts: 11
Thanks: 2
Thanked 0 Times in 0 Posts
DazednConfused is an unknown quantity at this point
@ Old Pedant,
I thought that might be the case, but since I am using a free database, I am limited on the size of the database, and I know pictures will eat up my 2MB allowance really quickly. What I did do, was add another field to my table for the pathnames.
I just want to be sure that I am inserting the pathname correctly, I have the images stored on the server in the directory that I have the index page stored, so my pathname for the file would be krystlekleen.batcave.net/2000%20Jeep%20Cherokee%20Black.jpg
since the url is krystlekleen.batcave.net
Did I get that correct?
DazednConfused is offline   Reply With Quote
Old 04-27-2012, 02:36 AM   PM User | #5
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,162
Thanks: 59
Thanked 3,992 Times in 3,961 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
You don't really need to store the website URL unless you will be serving up the images via some other URL.

I would also strong urge you, for your own sanity, to put the images into a separate folder.

That is: krystlekleen.batcave.net/images/2000%20Jeep%20Cherokee%20Black.jpg

And, again, if all images are in the same folder, then you only need to store the name, per se, in the DB: 2000%20Jeep%20Cherokee%20Black.jpg

It's easy enough, in your PHP or whatever code to prefix the URL with "images/" or even "krystlekleen.batcave.net/images/" or even "http://krystlekleen.batcave.net/images", as needed.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:13 PM.


Advertisement
Log in to turn off these ads.