SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    shauno7's Avatar
    Join Date
    Jul 2004
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to insert image into database?

    Is there any way to store an acutal image(jpeg, gif) into a database? I'm using a cms for my website, and I want to try and extract almost everything from the database, so that includes the images. Could someone show me how this can be accomplished?
    Thanks.

  2. #2
    SitePoint Wizard guelphdad's Avatar
    Join Date
    Oct 2003
    Location
    St. Catharines, ON Canada
    Posts
    1,708
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Almost everything I've seen on this says you are better off storing an image elsewhere and the path to the image in the database itself.

  3. #3
    chown linux:users\ /world Hartmann's Avatar
    Join Date
    Aug 2000
    Location
    Houston, TX, USA
    Posts
    6,455
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    It is called storing binary data in the database and yes it is possible. However, like Dave said, it is considered inefficient and looked down upon.

    There is a good article at PHPBuilder about it though, if you are still interested: http://www.phpbuilder.com/columns/florian19991014.php3

    Your best bet though is to store the location of the image in your database and just retrieve that. It will require less resources and be faster than if you stored the actual image in the database.


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
  •