Web Hosting Forums

Results 1 to 6 of 6

This is a discussion on A good tutorial? in the Hosting Talk & Chit-chat forum
If anyone knows of one, would someone please point me towards a good tutorial on storing images in a database then fetching them out again. ...

  1. #1
    Loyal Client
    Join Date
    Feb 2002
    Posts
    29

    A good tutorial?

    If anyone knows of one, would someone please point me towards a good tutorial on storing images in a database then fetching them out again.

    I would really appreciate it and thanks in advance!

    GC
    gcarlyle22

  2. #2
    alexodin
    Guest
    good tutotrial is vBulletin, if you have their source code.

    my 2c: dont do it. Dont store images in to database.
    if you have just a few of images to store - it is fine, but if you plan to have 100s or 1000s of them - dont store them in db. First you will kill MySQL server and it will require a lot of CPU time.
    I know a few web news sites who is using vBulletin as a message board and all of them decided to disable image attachment, because of that problem.

    as an option, consider this way:
    store file names, file size, image resolution, file description and so on in to database and just copy this file/image to special folder. you may want to rename it by using date/time stamp to make sure that you will not overwrite a file/image with the same name.
    By doing this way, your database will work fine, and quick(!)

  3. #3
    Loyal Client jkeller's Avatar
    Join Date
    Feb 2002
    Location
    Paris, France
    Posts
    1,502
    I agree completely with Alex, and not just for large images (or large numbers of images).

    Images stored that way will appear to the browser as dynamically generated and will not be cached. So, each page view becomes a hit on your fetch routine. You'll use twice that bandwidth -- once to fetch the image, once to pass it viw http.

    Plus, the bonus of using "real" images is that static pages can use them, too. Maybe not a big deal in your case, but I'm always looking for extra reasons to blabber on about...

  4. #4
    Loyal Client
    Join Date
    Feb 2002
    Posts
    29

    Ok wow

    I didn't know it would be so bad on the database.

    Could you point me in the right direction on a tutorial on how to store file names, file size, image resolution, file description and so on into the database and then getting the info back out?

    Thanks
    gcarlyle22

  5. #5
    alexodin
    Guest
    well... i dont have any specific tutorials...
    check this out:
    Building a Photo Gallery
    http://hotwired.lycos.com/webmonkey/...tw=programming
    http://www.hotscripts.com/PHP/Tips_a..._Manipulation/
    it is a section "Image Manipulation"

    the goal is to upload the file, than using "image functions" (http://www.php.net/manual/en/ref.image.php) "prepare the file: take dimension, resolution, size and so on.
    after that store it in to database record.

    links:
    http://hotwired.lycos.com/webmonkey/99/25/index3a.html
    http://hotwired.lycos.com/webmonkey/01/21/index4a.html

  6. #6
    Loyal Client
    Join Date
    Feb 2002
    Posts
    29
    alexodin,

    These were greate. They helped tremendously!

    Thank you
    GC
    gcarlyle22

Bookmarks

Posting Permissions

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