Kathleen Ballard wrote:
> Mig,
> This is some code I was sent when I needed to display images that were
> located outside of the web dir.
>
> ~~~~~~~~~~
> If you want the images outside the web-tree, your image tag would be more
> like this:
>
> <IMG SRC=display.php3?imagefile=happy.gif>
>
> Then display.php3 would look not unlike:
>
> <?php
> header("Content-type: image/gif");
> header("Content-length: " . filesize("C:/hide/images/$imagefile"));
> //Caching headers here.
> //And Content-disposition
> //And Content-filename
> //and so on.
> readfile("C:/hide/images/$imagefile");
> ?>
Hello Kathleen
Thanks very much, I checked your idea and must say it works nice .... with files, but
when I need pass strings like parameters for PHP program, things become difficult.
I will follow your clever idea, because I know it will work, but first need solve two
problems (sorry I am newer to PHP and sometimes confused the way PHP treat variables ).
First problem is: how store content of image file (jpg or gif) into MySql BLOB fields?
Mysql update command uses variable='value' to update (or insert) values. Image data
has lot of ' " ' and " ' " in between, so I receive 1054 ERROR when trying to pass
update image='$image', because $image variable expands before sending data to database.
Second problem is:
how to pass later same string $image recovered from MySql to display.php3 program?
In your example, your are passing file name, a very single string that wouldn't cause
any confusion, but when passing display.php3?stream-image=$image things will become
hard.
Probably I will need to reopen Mysql database into display.php3 program and so I would
pass only record number to display.php3, letting this program to search again record.
Anyway, I modified display.php3 program to execute $image = fread(file...) and then
echo $image, .... and it works fine.., that's to say, it is just question of string
treatment, and really GD library is not necessary.
Thanks
Miguel
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]