Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Dec 2011
    Posts
    11
    Thanks
    2
    Thanked 0 Times in 0 Posts

    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!

  • #2
    New Coder
    Join Date
    Dec 2011
    Posts
    11
    Thanks
    2
    Thanked 0 Times in 0 Posts
    I like easy, and I understand what your saying. Im going to set up some rows and give that method a try, thank you

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,554
    Thanks
    80
    Thanked 4,620 Times in 4,583 Posts
    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.

  • #4
    New Coder
    Join Date
    Dec 2011
    Posts
    11
    Thanks
    2
    Thanked 0 Times in 0 Posts
    @ 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?

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,554
    Thanks
    80
    Thanked 4,620 Times in 4,583 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •