Re: ByteA for binary data?

Поиск
Список
Период
Сортировка
От Robert Myers
Тема Re: ByteA for binary data?
Дата
Msg-id Pine.BSF.4.21.0202242237070.22882-100000@ns1.whiterose.net
обсуждение исходный текст
Ответ на Re: ByteA for binary data?  ("Thomas T. Thai" <tom@minnesota.com>)
Ответы Re: ByteA for binary data?
Список pgsql-general
I did this with the CVS version of PHP, v 4.2.0 dev.

I downloaded it for the function pg_escape_bytea, still no go, I can't get
the data into the field.


-Bob
ccrider@whiterose.net
Systems Administrator for whiterose.net
http://www.whiterose.net

On Sun, 24 Feb 2002, Thomas T. Thai wrote:

> On Sun, 24 Feb 2002, Robert Myers wrote:
>
> > I'm having a problem with the bytea datatype.  I'm trying to store image
> > data inside the field in a table, and php seems to only be sending a small
> > portion of the image into the database.
> >
> > I'm not sure how I should approach storing image data inside of Postgres.
> >
> > I really need to improve the management of my images.
> >
> > Has anyone else done this without the benefit of the LO support?
> >
> > I've read the available documentation on LO and bytea, and both seem to
> > have troubles, is this something that will be fixed in a future
> > release?  I'm currently running 7.2.
>
> to use bytea with php, encode the image data with escByteA() below before
> storing it in your db. then when you retrieve the data, use php's
> stripcslashes(). i've tested this on various image data and they all work
> just fine.
>
> function escByteA($binData) {
>   /**
>    * \134 = 92 = backslash, \000 = 00 = NULL, \047 = 39 = Single Quote
>    *
>    * str_replace() replaces the searches array in order.
>    * Therefore, we must
>    * process the 'backslash' character first. If we process it last, it'll
>    * replace all the escaped backslashes from the other searches that came
>    * before. tomATminnesota.com
>    */
>   $search = array(chr(92), chr(0), chr(39));
>   $replace = array('\\\134', '\\\000', '\\\047');
>   $binData = str_replace($search, $replace, $binData);
>   return $binData;
> }
>


В списке pgsql-general по дате отправления:

Предыдущее
От: "Thomas T. Thai"
Дата:
Сообщение: Re: ByteA for binary data?
Следующее
От: Robert Myers
Дата:
Сообщение: Re: ByteA for binary data?