Re: [PHP] postgres-embedded images via php. two issues...

2004-11-02 Thread raditha dissanayake
P. George wrote:
i am storing images in a postgres database and i have set up a little 
php file to retrieve them in such a way that i can do:
This topic came up a few days ago and the pros and cons of saving images 
in a data base was argued with very few pros been given. However the 
defining moment is when some one mailed a link to a zend article where a 
benchmark had been done comparing the two methods. Embedding in a 
database came up second.

--
Raditha Dissanayake.

http://www.radinks.com/sftp/ | http://www.raditha.com/megaupload
Lean and mean Secure FTP applet with | Mega Upload - PHP file uploader
Graphical User Inteface. Just 128 KB | with progress bar.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] postgres-embedded images via php. two issues...

2004-11-02 Thread Robby Russell
On Wed, 2004-11-03 at 10:20 +1000, Tom Rogers wrote:
> Hi,
> 
> Wednesday, November 3, 2004, 8:45:17 AM, you wrote:
> PG> i am storing images in a postgres database and i have set up a little 
> PG> php file to retrieve them in such a way that i can do:
> 
> PG> echo "";
> 
> PG> ...from another php file.
> 
> PG> it's working great, BUT i've noticed two things that bother me:
> 
> PG> [1]  if someone wants to download an image, they can, but it will be 
> PG> downloaded as "gif.php" instead of "whatever.gif".  even though 
> PG> renaming the file solves the problem, users will be confused by this.
> 
> 
> It does not matter what the extension is, it is the header that has more sway
> 
> 
> PG> [2]  (and i think this may be related to the first problem) is that in 
> PG> at least one of my browsers (camino/osx) the images are ALWAYS pulled 
> PG> directly from the server.  they are never cached by the browser.  i 
> PG> suppose all browsers may be behaving this way, but in camino, it is 
> PG> blatantly and visually obvious as you watch the gif being slowly 
> PG> downloaded/displayed over a slow connection.
> 
> The browser wont cache url's that have the ? in them so change your info passing
> scheme to echo "";
> then process the query string to extract the info
> 
> You could even add a dummy value at the end like
> src='gif.php/name=$picname/type.gif to make it look like a gif'
> 

In my .htaccess file, I have placed the following :

RewriteEngine On
RewriteRule ^images/([0-9]+)$ image.php?id=$1 [L]
RewriteRule ^images/(.*)$ image.php?filename=$1 [L]

This allows either: http://localhost/images/5 or
http://localhost/images/myimage.png to work. I prefer the filename as it
looks cleaner and appears to be more standard. So, in a webpage, I can
now add the following html code to show the image.

http://localhost/images/myimage.png"; />

-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
*--- Now supporting PHP5 ---
/


signature.asc
Description: This is a digitally signed message part


Re: [PHP] postgres-embedded images via php. two issues...

2004-11-02 Thread Tom Rogers
Hi,

Wednesday, November 3, 2004, 8:45:17 AM, you wrote:
PG> i am storing images in a postgres database and i have set up a little 
PG> php file to retrieve them in such a way that i can do:

PG> echo "";

PG> ...from another php file.

PG> it's working great, BUT i've noticed two things that bother me:

PG> [1]  if someone wants to download an image, they can, but it will be 
PG> downloaded as "gif.php" instead of "whatever.gif".  even though 
PG> renaming the file solves the problem, users will be confused by this.


It does not matter what the extension is, it is the header that has more sway


PG> [2]  (and i think this may be related to the first problem) is that in 
PG> at least one of my browsers (camino/osx) the images are ALWAYS pulled 
PG> directly from the server.  they are never cached by the browser.  i 
PG> suppose all browsers may be behaving this way, but in camino, it is 
PG> blatantly and visually obvious as you watch the gif being slowly 
PG> downloaded/displayed over a slow connection.

The browser wont cache url's that have the ? in them so change your info passing
scheme to echo "";
then process the query string to extract the info

You could even add a dummy value at the end like
src='gif.php/name=$picname/type.gif to make it look like a gif'

PG> anyone know what to do for either of these?  concerning [2], i'm 
PG> thinking maybe i can implant the local browser cache _manually_ instead 
PG> of depending on the browser to do it for me? if so, how would i go 
PG> about doing that?

PG> thanks.

PG> - philip

-- 
regards,
Tom

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



Re: [PHP] postgres-embedded images via php. two issues...

2004-11-02 Thread Robby Russell
On Tue, 2004-11-02 at 16:45 -0600, P. George wrote:
> i am storing images in a postgres database and i have set up a little 
> php file to retrieve them in such a way that i can do:
> 
> echo "";
> 
> ...from another php file.
> 
> it's working great, BUT i've noticed two things that bother me:
> 
> [1]  if someone wants to download an image, they can, but it will be 
> downloaded as "gif.php" instead of "whatever.gif".  even though 
> renaming the file solves the problem, users will be confused by this.
> 
> [2]  (and i think this may be related to the first problem) is that in 
> at least one of my browsers (camino/osx) the images are ALWAYS pulled 
> directly from the server.  they are never cached by the browser.  i 
> suppose all browsers may be behaving this way, but in camino, it is 
> blatantly and visually obvious as you watch the gif being slowly 
> downloaded/displayed over a slow connection.
> 
> anyone know what to do for either of these?  concerning [2], i'm 
> thinking maybe i can implant the local browser cache _manually_ instead 
> of depending on the browser to do it for me? if so, how would i go 
> about doing that?
> 
> thanks.
> 
> - philip
> 

My guess is that your browser isn't set to cache .php file output. If
it's caching images, you might need to trick it into thinking that it's
an image.

for example, look at the mod_rewrite rules at the bottom of this blog
post.

http://blog.planetargon.com/index.php?/archives/27_Displaying_image_from_PostgreSQL_large_object_with_PHP.html

I don't know if this *is* the issue, but it's my first guess.

-Robby



-- 
/***
* Robby Russell | Owner.Developer.Geek
* PLANET ARGON  | www.planetargon.com
* Portland, OR  | [EMAIL PROTECTED]
* 503.351.4730  | blog.planetargon.com
* PHP/PostgreSQL Hosting & Development
*--- Now supporting PHP5 ---
/


signature.asc
Description: This is a digitally signed message part


[PHP] postgres-embedded images via php. two issues...

2004-11-02 Thread P. George
i am storing images in a postgres database and i have set up a little 
php file to retrieve them in such a way that i can do:

echo "";
...from another php file.
it's working great, BUT i've noticed two things that bother me:
[1]  if someone wants to download an image, they can, but it will be 
downloaded as "gif.php" instead of "whatever.gif".  even though 
renaming the file solves the problem, users will be confused by this.

[2]  (and i think this may be related to the first problem) is that in 
at least one of my browsers (camino/osx) the images are ALWAYS pulled 
directly from the server.  they are never cached by the browser.  i 
suppose all browsers may be behaving this way, but in camino, it is 
blatantly and visually obvious as you watch the gif being slowly 
downloaded/displayed over a slow connection.

anyone know what to do for either of these?  concerning [2], i'm 
thinking maybe i can implant the local browser cache _manually_ instead 
of depending on the browser to do it for me? if so, how would i go 
about doing that?

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