Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

saving images as blob in db or on file system

Options
  • 09-09-2005 2:30am
    #1
    Registered Users Posts: 252 ✭✭


    Which is the best option.
    saving images as blob in db or on file system ?
    pros & cons in your experience ?

    Tnx

    (ive been looking for a way to resize and uploaded image on the fly without saving the original and then generating a thumbnail... appreciate it if anyone has done this and can point in right direction ... in using php mysql and gd2)


Comments

  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    Which is the best option.
    saving images as blob in db or on file system ?
    pros & cons in your experience ?
    Depends on what you mean by "on the fly" below. If you mean you're going to be generating an image on the fly every time it's requested, then pulling it in from the database probably isn't going to add much more to the overhead you're already generating. However if it's only going to be generated on the initial upload, then definitely the file system.
    (ive been looking for a way to resize and uploaded image on the fly without saving the original and then generating a thumbnail... appreciate it if anyone has done this and can point in right direction ... in using php mysql and gd2)
    Google for various combinations of the following keywords: php gd imagemagick resize thumbnail. Also open up the source of Gallery and Coppermine (google) and see how they do it.

    adam


  • Registered Users Posts: 4,003 ✭✭✭rsynnott


    dahamsta wrote:
    Depends on what you mean by "on the fly" below. If you mean you're going to be generating an image on the fly every time it's requested, then pulling it in from the database probably isn't going to add much more to the overhead you're already generating. However if it's only going to be generated on the initial upload, then definitely the file system.
    It may anyway, if your db server is on a different machine to your webserver; it will create lots of internal traffic, which may not be desirable. There's rarely compelling reason to put images in databases; just use the database to keep track of the image file names.


  • Registered Users Posts: 46 nogihno


    Store the address of the file/image on the server in the DB


  • Closed Accounts Posts: 53 ✭✭endanagle


    i've worked with imagemagick and GD2 in past. if you're uploading an image and only doing the mod once then its the best to do it this way rather than store in db.

    just if you're doing the process on images with IPTC info stored make sure you use the resize option in imagemagick and not the thumbnail as it strips out the IPTC info


  • Registered Users Posts: 252 ✭✭ConsultClifford


    rsynnott wrote:
    It may anyway, if your db server is on a different machine to your webserver; it will create lots of internal traffic, which may not be desirable. .

    good point

    Store the address of the file/image on the server in the DB

    ya thats what i usually do ... just having taken over dev of a componenet and last developer was saving logos into db

    Tnx


  • Advertisement
  • Closed Accounts Posts: 132 ✭✭canker


    if you use dreamweaver for ur development I would use this extension

    http://www.dmxzone.com/showDetail.asp?TypeId=3&NewsId=4988

    it will resize, compress, generate thumbs on upload and it fits in with dreamweavers built in insert/update record behaviours for saving the file name to the database and all without you having to writing a single line o' code!

    I've used the asp version with excellent results (link is to the php version coz most folk round here seem to be php freaks)


Advertisement