Re: Storing images in PG?

Поиск
Список
Период
Сортировка
От Joe Conway
Тема Re: Storing images in PG?
Дата
Msg-id 01ac01c12670$21265f00$48d210ac@jecw2k1
обсуждение исходный текст
Ответ на Storing images in PG?  ("Dr. Evil" <drevil@sidereal.kz>)
Ответы Re: Storing images in PG?  ("Dr. Evil" <drevil@sidereal.kz>)
Список pgsql-general
> I guess another option would be to encode the retrieved data as base64,
like
> this (works in 7.2devel *only*):
>
>     SELECT encode(image, 'hex') FROM imagetable WHERE ...
>
> And then convert from hex back to bin:
>
> function hex2bin($data)
> {
>  $data = trim($data);
>  $len = strlen($data);
>  return pack("H" . $len, $data);
> }
>

Sorry, I meant to say "to encode the retrieved data as hex, like . . ."
above. But you could also use base64:

     SELECT encode(image, 'base64') FROM imagetable WHERE ...

function base64_to_bin($data)
{
 $data = trim($data);
 return base64_decode($data);
}

-- Joe



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: why sequential scan
Следующее
От: Justin Clift
Дата:
Сообщение: Re: PostgreSQL buffer exploits