Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2003
    Posts
    53

    Unanswered: How to store the picture in to PostgreSQL Database?

    I mean that I want to keep picture file in BLOB type to Database(does not mean keep the path or directory of file).

    I use PostgreSQL 8.0 on Windows2000. I don't sure this correct or not that BLOB in PostgreSQL is Bytea. I try to store picture like JPEG in to database with Bytea type. I found that the data is stored in /XXX (binary) format. I try to get this data and show it with Visual Basic but it's look like that the data is not a picture data. Please give me your suggestion that solve this problem clear. How to store the picture in to PostgreSQL Database?

    More Information:::
    Before I can keep picture data into Bytea I face to the serious problem about some special character cannot be saved. For example I must be change ' to \' , \ to \\ etc. before I can save it into database.

    Example of code I use for change the special character:::
    Replace(Replace(Replace(Replace(Replace(Replace(Re place(Replace(Replace(Replace(vPicMember.Read, "\", "\\"), "'", "\'"), """", "\"""), vbTab, "\t"), vbVerticalTab, "\v"), vbLf, "\n"), vbCr, "\r"), vbFormFeed, "\f"), vbBack, "\b"), vbNullChar, "\0")
    ^solaris^

  2. #2
    Join Date
    Jun 2004
    Posts
    31
    Quote Originally Posted by solar115
    I mean that I want to keep picture file in BLOB type to Database(does not mean keep the path or directory of file).
    I had this very problem where I needed to store tens of thousands of pictures in various formats: rgba, eps, jpg, png, etc.

    This method may not be optimal, but I was a bit wary of binary issues. I chose to store the images hex-encoded into a field of type text. If I understand it correctly, these fields hold up to 2GB, so the hex encoding will max out with a picture 1GB in size, which should be enough for a while.

Posting Permissions

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