From: Csanyi Pal <csanyipal@gmail.com>
To: Ho John Lee <hjl@mindspring.com>
Cc: PostgreSQL General <pgsql-general@lists.postgresql.org>
Subject: Re: How to display stored image as bytea or as large objects?
Date: Thu, 15 Jul 2021 06:12:09 +0200
Message-ID: <c47b49c2-f67f-6dc8-4fff-4d9758a5f2a4@gmail.com> (raw)
In-Reply-To: <CAO=B_QZaO-NGaWCfpPGyn_AVO1RVvBWdFnWdDXok-7D0u-8yqw@mail.gmail.com>
References: <e2730d87-0c22-f3f8-82aa-0a78316e2c00@gmail.com>
<CAO=B_QZaO-NGaWCfpPGyn_AVO1RVvBWdFnWdDXok-7D0u-8yqw@mail.gmail.com>
2021. 07. 14. 22:17 keltezéssel, Ho John Lee írta:
> If you have the binary data for the image in the bytea field, DBeaver
> will display the image when you select that field in table view of the data.
> The field will display something like "ÿØÿà JFIF [nnnnn]" in the row
> (first part of data as unicode, and data length in bytes), you won't see
> the image unless you put focus on it.
I will try this, but do not know which SQL code will store an image in a
bytea data type column?
Could you give such SQL code please?
At the moment I have stored image in an oid data type column.
> .--hjl
> On Wed, Jul 14, 2021 at 12:57 PM Csanyi Pal <csanyipal@gmail.com
> <mailto:csanyipal@gmail.com>> wrote:
>
> Hi,
>
> I am a novice in postgresql language.
>
> By reading the documentation about storing binary data in postgresql
> database, I realize that that one can store images as binary data by
> using bytea or BLOB data types.
>
> I am running postgresql on Ubuntu 20.04.2 LTS and using pgAdmin4 in
> Desktop mode.
>
> I have stored an image in one of my table with this command:
>
> <code>
> insert into leckek
> (az, a_tanitas_nyelve, mely_negyedevben, mely_osztalyban,
> mely_tagozaton, mely_orakon, a_tanitas_temaja,
> a_lecke_neve, a_lecke_gyakorlati_reszenek_neve,
> a_lecke_gyakorlati_reszenek_dokumentuma,
> a_lecke_elmeleti_reszenek_neve,
> a_lecke_elmeleti_reszenek_dokumentuma,
> a_lecke_elmeleti_reszenek_tesztje)
> values (default, 'Hu', 1, 5, 'b', '1-2', 'Élet és mukakörnyezet',
> 'A technika és technológia fogalma, szerepe és
> jelentősége',
> 'másolás',
> default,
> 'A lényeg',
>
> lo_import('/home/pali/Irataim/Iskola/IskolaEv_2020_2021/MuszakiOraim/Digitalis_Tananyagok_Orakra/Hu/5/5_osztaly_Tananyag_01_02_orara.png'),
> default)
> </code>
>
> so I have now in this table the first row:
> 1 "Hu" 1 5 "b" "1-2 " "Élet és
> mukakörnyezet" "A technika és
> technológia fogalma, szerepe és jelentősége" "másolás"
> "A lényeg" "16800"
>
> Here the 16800 is the OID of the binary data, the image.
>
> I would like to know how can one display this stored image somehow by
> using some IDE for manage databases?
>
> In applications like pgAdmin4, Libreoffice Base, pgModeler, DBeaver one
> can't display this stored image.
>
> In SQLiteBrowser (this is an IDE for SQLite databases) one can display
> with easy the stored image.
>
> So is there an easy way to display a stored image in postgresql?
>
> --
> Best,
> from Paul
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: csanyipal@gmail.com, hjl@mindspring.com
Subject: Re: How to display stored image as bytea or as large objects?
In-Reply-To: <c47b49c2-f67f-6dc8-4fff-4d9758a5f2a4@gmail.com>
References: <e2730d87-0c22-f3f8-82aa-0a78316e2c00@gmail.com> <CAO=B_QZaO-NGaWCfpPGyn_AVO1RVvBWdFnWdDXok-7D0u-8yqw@mail.gmail.com> <c47b49c2-f67f-6dc8-4fff-4d9758a5f2a4@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox