Re: [PHP] pictures stored in PostgreSQL DB

2007-03-04 Thread Fergus Gibson
Alain Roger wrote:
 I know how to do that for 1 picture. But i want to display the pictures as
 thumbnail... so several pictures on the same PHP pages, with some texts.

Seems to me that Matt's suggestion is perfectly applicable.  You could
simple add img tags as necessary, each with the call to the other
script with the correct parameter.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] pictures stored in PostgreSQL DB

2007-03-03 Thread Alain Roger

I know how to do that for 1 picture. But i want to display the pictures as
thumbnail... so several pictures on the same PHP pages, with some texts.
therefore, your solution does not correspond to what i need.

Sorry.

AL.

On 3/3/07, Matt Carlson [EMAIL PROTECTED] wrote:


If I were you, I would make a page that does nothing but returns an
image.  Something like getimage.php?image=whatever you are using in your
db and call it with img src=getimage.php?image=xxx /.

Hope that helps.


- Original Message 
From: Alain Roger [EMAIL PROTECTED]
To: PHP General List php-general@lists.php.net
Sent: Saturday, March 3, 2007 3:18:25 AM
Subject: [PHP] pictures stored in PostgreSQL DB

Hi,

It's amazing that my previous post has raised so much consideration about
the fact to store or not pictures into DB.
However, none of those posts answered to my question... How can i retrieve
and display those pictures to my PHP pages ?

Basically, on my PHP page I have some texts and I would like to extract
from
DB the pictures to display.
Therefore, set the header to mine JPEG or GIF does not allow to have text
also.

So please, how can i do to display pictures from DB, when my PHP page also
include texts and other images (from filesystem) ?

In fact i would like to do something like a thumbnail...

thanks a lot,

--
Alain

Windows XP SP2
PostgreSQL 8.1.4
Apache 2.0.58
PHP 5







--
Alain

Windows XP SP2
PostgreSQL 8.1.4
Apache 2.0.58
PHP 5


Re: [PHP] pictures stored in PostgreSQL DB

2007-03-03 Thread Børge Holen
To fetch an image from a database you need to call a separate file 
witch acts as the image... it is this file who set the image header.
the text is still fetched in the original file.

On Saturday 03 March 2007 10:18, Alain Roger wrote:
 Hi,

 It's amazing that my previous post has raised so much consideration about
 the fact to store or not pictures into DB.
 However, none of those posts answered to my question... How can i retrieve
 and display those pictures to my PHP pages ?

 Basically, on my PHP page I have some texts and I would like to extract
 from DB the pictures to display.
 Therefore, set the header to mine JPEG or GIF does not allow to have text
 also.

 So please, how can i do to display pictures from DB, when my PHP page also
 include texts and other images (from filesystem) ?

 In fact i would like to do something like a thumbnail...

 thanks a lot,

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] pictures stored in PostgreSQL DB

2007-03-03 Thread Martin Marques

Alain Roger wrote:

Hi,

It's amazing that my previous post has raised so much consideration about
the fact to store or not pictures into DB.


It was nice, wasn't it? :-D


However, none of those posts answered to my question... How can i retrieve
and display those pictures to my PHP pages ?


???

How do you plan to store them? bytea, text with base64 
encoding/decoding, blobs?


Basically, on my PHP page I have some texts and I would like to extract 
from

DB the pictures to display.
Therefore, set the header to mine JPEG or GIF does not allow to have text
also.


You have to do it in two seperate steps (which IMHO is good):

1) First build an app to extract an image and show it. You should test 
it with you're browser and it should just show the image.
2) Build you're PHP page and make references in scr of the img tag to 
the app above (referencing with some ID to the JPG you want.


I think that you will have to send some headers in one so the the 
browser knows the length of the image, content type, etc. Not really 
sure, but it won't hurt to check it out.



So please, how can i do to display pictures from DB, when my PHP page also
include texts and other images (from filesystem) ?

In fact i would like to do something like a thumbnail...


That's a differnet, and even more complicated story.

--
 21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
-
Lic. Martín Marqués |   SELECT 'mmarques' ||
Centro de Telemática|   '@' || 'unl.edu.ar';
Universidad Nacional|   DBA, Programador,
del Litoral |   Administrador
-

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] pictures stored in PostgreSQL DB

2007-03-03 Thread Robert Cummings
On Sat, 2007-03-03 at 11:02 +0100, Alain Roger wrote:
 I know how to do that for 1 picture. But i want to display the pictures as
 thumbnail... so several pictures on the same PHP pages, with some texts.
 therefore, your solution does not correspond to what i need.

You need two scripts. One script that contains the img tags to your
thumbnails, and another script that creates the thumbnails (possiblies
caches them), sets the appropriate header (Content-Type: image/xxx --
where xx is png or jpeg or gif or ...) and then flushes the image binary
content to the browser. You will also need to make use of the image
functions in PHP to create your thumbnail. Here are some links:

http://ca.php.net/manual/en/function.header.php
http://ca.php.net/manual/en/function.imagecreatefromstring.php
http://ca.php.net/manual/en/function.imagecopyresampled.php

Let say you create two scripts... gallery.php and showImage.php. Then
gallery.php will output content something like:

html
head/head
body
img
src=showImage.php?id=123amp;width=60amp;height=60amp;hash=KJHDKJHDKJHKDJHDJKHDKJHDJK
 /
img
src=showImage.php?id=124amp;width=60amp;height=60amp;hash=KJHDKJHDKJHKDJHDJKHDKJHDJK
 /
img
src=showImage.php?id=125amp;width=60amp;height=60amp;hash=KJHDKJHDKJHKDJHDJKHDKJHDJK
 /
img
src=showImage.php?id=126amp;width=60amp;height=60amp;hash=KJHDKJHDKJHKDJHDJKHDKJHDJK
 /
/body
/html

This way you can provide the dimension information to the showImage.php
script as width and height and it can create a thumbnail with those
constraints. I always ad a hash for that kind of script so that users
can't arbitrarily load images at any size they want. The hash is usually
an md5() hash of the id, width, height, and some private salt string.
This also makes it unlikely they could load an arbitrary image ID.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] pictures stored in PostgreSQL DB

2007-03-03 Thread Martin Marques

Robert Cummings escribió:

On Sat, 2007-03-03 at 11:02 +0100, Alain Roger wrote:

I know how to do that for 1 picture. But i want to display the pictures as
thumbnail... so several pictures on the same PHP pages, with some texts.
therefore, your solution does not correspond to what i need.


You need two scripts. One script that contains the img tags to your
thumbnails, and another script that creates the thumbnails (possiblies
caches them), sets the appropriate header (Content-Type: image/xxx --
where xx is png or jpeg or gif or ...) and then flushes the image binary
content to the browser. You will also need to make use of the image
functions in PHP to create your thumbnail. Here are some links:

http://ca.php.net/manual/en/function.header.php
http://ca.php.net/manual/en/function.imagecreatefromstring.php
http://ca.php.net/manual/en/function.imagecopyresampled.php

Let say you create two scripts... gallery.php and showImage.php. Then
gallery.php will output content something like:


Robert! You're spoiling him! :-D

He has to know how to read the messages and interpret them correctly 
(and get the code done well).


--
select 'mmarques' || '@' || 'unl.edu.ar' AS email;
-
Martín Marqués  |   Programador, DBA
Centro de Telemática| Administrador
   Universidad Nacional
del Litoral
-

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] pictures stored in PostgreSQL DB

2007-03-03 Thread Alain Roger

Hi Rob,

thanks for information.
As you told me i use 2 files to do what i need. 1 for displaying th
thumbnail and the other just to display the picture.
That's works great.

However, how can i resize the picture (in my thumbnail) if my pictures are
stored to DB ?
i mean that my picture is stored in DB as bytea (so in base 8) and therefore
the imagecopyresampled or imagecopyresize functions do not work.
I also do not want to create a temporally file on the filesystem just to
hold the resized picture.

So is there another possibility how to resize picture ?

thanks a lot,

Al.


Re: [PHP] pictures stored in PostgreSQL DB

2007-03-03 Thread Robert Cummings
On Sat, 2007-03-03 at 14:57 +0100, Alain Roger wrote:
 Hi Rob,
 
 thanks for information.
 As you told me i use 2 files to do what i need. 1 for displaying th
 thumbnail and the other just to display the picture.
 That's works great.
 
 However, how can i resize the picture (in my thumbnail) if my pictures are
 stored to DB ?
 i mean that my picture is stored in DB as bytea (so in base 8) and therefore
 the imagecopyresampled or imagecopyresize functions do not work.
 I also do not want to create a temporally file on the filesystem just to
 hold the resized picture.
 
 So is there another possibility how to resize picture ?

Did you read the following link in my previous email?

http://ca.php.net/manual/en/function.imagecreatefromstring.php

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] pictures stored in PostgreSQL DB

2007-03-03 Thread Børge Holen
On Saturday 03 March 2007 14:57, Alain Roger wrote:
 Hi Rob,

 thanks for information.
 As you told me i use 2 files to do what i need. 1 for displaying th
 thumbnail and the other just to display the picture.
 That's works great.

 However, how can i resize the picture (in my thumbnail) if my pictures are
 stored to DB ?
 i mean that my picture is stored in DB as bytea (so in base 8) and
 therefore the imagecopyresampled or imagecopyresize functions do not work.
 I also do not want to create a temporally file on the filesystem just to
 hold the resized picture.

 So is there another possibility how to resize picture ?

 thanks a lot,

 Al.

This seems farfetched...

-- 
---
Børge
Kennel Arivene 
http://www.arivene.net
---

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php