storing images

storing images

am 29.01.2003 17:26:15 von angelo.rigo

Hi!

I am searching for tutorials to store and properly display images using
php-postgresql!

What data type must be the image collumn on my database?
how can i display the images ?
how can i control the size of the stored image?

Thank?s in advance for any opinion!

Angelo Rigo
amr.freezope.org


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Re: storing images

am 30.01.2003 11:57:06 von adriantineo

>I am searching for tutorials to store and properly display images using
>php-postgresql!
>
>What data type must be the image collumn on my database?
>how can i display the images ?
>how can i control the size of the stored image?

To include large objects (like images) in the database you need to use
BLOBs, I think the type for postgresql is "bytea". Check the docs. I seem to
remember that you inserted them by means of "lo_import" and extracted them
via "lo_export".

I am designing an application that needs images (who doesn't?) but I have
decided to store the images separately as usual images (gif, jpg) and store
in the database the link to those images, so I read the link from the
database and the php script loads the image from the link. I don't have any
special requirement for the security of the images, that is, if you knew the
link yourself you could load it in the browser but that is not important.

Adrian Tineo


---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Re: storing images

am 30.01.2003 22:16:39 von Scott Marlowe

On Thu, 30 Jan 2003, Adrian Tineo wrote:

>
>
> >I am searching for tutorials to store and properly display images using
> >php-postgresql!
> >
> >What data type must be the image collumn on my database?
> >how can i display the images ?
> >how can i control the size of the stored image?
>
> To include large objects (like images) in the database you need to use
> BLOBs, I think the type for postgresql is "bytea". Check the docs. I seem to
> remember that you inserted them by means of "lo_import" and extracted them
> via "lo_export".
>
> I am designing an application that needs images (who doesn't?) but I have
> decided to store the images separately as usual images (gif, jpg) and store
> in the database the link to those images, so I read the link from the
> database and the php script loads the image from the link. I don't have any
> special requirement for the security of the images, that is, if you knew the
> link yourself you could load it in the browser but that is not important.

This isn't strictly true anymore. You can now use the bytea type to store
binary objects into, but they need to be properly escaped. much easier to
manipulate than those pesky large objects.


---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Re: storing images

am 31.01.2003 10:03:43 von Nash Pelayo

much better to store your images in a drive location
(folder), then just store the path of that image/s to
your database ( e.g. "/images/sample.jpg").. This
process optimize your database to handle less capacity
of record.

proposed datbase design
TABLE
id=tinyint
name=varchar(50)
image_path=varchar(100)

SAMPLE DATABASE (id,name,image_path)
1, roses, /images/roses.jpg
2, orchid, /images/orchid.jpg

To display the image, just retrieve the image path of
the image(image_path field), then echo it to your
HTML/PHP page script.

-daBeast-


--- "scott.marlowe" wrote:
> On Thu, 30 Jan 2003, Adrian Tineo wrote:
>
> >
> >
> > >I am searching for tutorials to store and
> properly display images using
> > >php-postgresql!
> > >
> > >What data type must be the image collumn on my
> database?
> > >how can i display the images ?
> > >how can i control the size of the stored image?
> >
> > To include large objects (like images) in the
> database you need to use
> > BLOBs, I think the type for postgresql is "bytea".
> Check the docs. I seem to
> > remember that you inserted them by means of
> "lo_import" and extracted them
> > via "lo_export".
> >
> > I am designing an application that needs images
> (who doesn't?) but I have
> > decided to store the images separately as usual
> images (gif, jpg) and store
> > in the database the link to those images, so I
> read the link from the
> > database and the php script loads the image from
> the link. I don't have any
> > special requirement for the security of the
> images, that is, if you knew the
> > link yourself you could load it in the browser but
> that is not important.
>
> This isn't strictly true anymore. You can now use
> the bytea type to store
> binary objects into, but they need to be properly
> escaped. much easier to
> manipulate than those pesky large objects.
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org


=====
Note: The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify the sender immediately by replying to the message and deleting it from your computer. Thank you.

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster