From: | Nelson Green <nelsongreen84(at)gmail(dot)com> |
---|---|
To: | |
Cc: | pgsql <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Storing small image files |
Date: | 2013-05-10 13:25:33 |
Message-ID: | CAGo-KZkL0uQqJdc3xsjkYdqwavKR10zjhHOkm0WcXs9u0J62ug@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Fri, May 10, 2013 at 5:24 AM, Misa Simic <misa(dot)simic(at)gmail(dot)com> wrote:
> 2013/5/10 Eduardo Morras <emorrasg(at)yahoo(dot)es>
>
>>
>> Hi Nelson. I worked with images and Postgresql, and want to add some
>> comments:
>>
>> On Thu, 9 May 2013 13:40:15 -0500
>> Nelson Green <nelsongreen84(at)gmail(dot)com> wrote:
>> > OK, this is kind of convoluted, but I got a couple of test cases that
>> work
>> > for me. The steps to make the first one are below.
>> >
>> > First I took one of the photos and shrunk it real small using GIMP.
>>
>> If you want to manipulate images automatically, don't use GIMP, use
>> ImageMagick(for shell scripts) or OpenCV(for C sourcecode)
>>
>> > Then I
>> > manually converted that to a base64 encoded text file:
>> > /usr/bin/base64 < test.jpg > test.64
>>
>> If you must to use the pg shell, perhaps coding Misa's function in other
>> language (python f.ex.) allows you directly insert the bytea.
>>
>>
> well, with pl/python there is more power - no need to use
> lo_largobejects... However solution for him is not in function because of
> file is on different machine then Postgres...
>
> I think Nelson has found solution what works for him...
>
I did, but I have made note of your and Thomas's suggestions. I just wanted
to be able to verify that my DDL had done what I meant with a simple insert
and select. The real work will be done via a PHP front-end.
Thanks everyone!
>
> But now, what Thomas Keller suggested sounds as very good approach if user
> doesn't want to write his own client code...
>
> A use hint: disable toast compression for that table, images are already
>> compressed, you don't need to waste time with it.
>
>
>> > That outputs a base64 string that matches test.64. Outputting that to a
>> > file and then converting it back gives me my image:
>> > /usr/bin/base64 -d < output.64 > newtest.jpg
>> >
>> > Like I said, kind of crazy, but it satisfies me that my basic premise is
>> > doable. I'll still get one of the front-end developers to whip out some
>> PHP
>> > just to be safe.
>> >
>> > Thanks to all!
>>
>> --- ---
>> Eduardo Morras <emorrasg(at)yahoo(dot)es>
>>
>>
>> --
>> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
>> To make changes to your subscription:
>> http://www.postgresql.org/mailpref/pgsql-general
>>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Adrian Klaver | 2013-05-10 13:29:41 | Re: FATAL: database "a/system_data" does not exist |
Previous Message | Nelson Green | 2013-05-10 13:21:28 | Re: Storing small image files |