[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> 
> Yes, the method below would work just fine if you only needed to display
> one image. Trying it on a second image within the same generated page 
> would give you a "headers already sent" error.
> 
> > [...]
> > 
> > So your script will generate html like
> > <img src="/showimage.php?file=filename.jpg">
> > 
> > then showimage.php will do something:
> > header('content-type: appropricate/type');
> > // content-length would be good
> > readfile($file);
> > 
> > HTH Curt --

it shouldn't perhaps I didn't make it clear enough.  You will have two
php scripts. One to output html the other to output images. So you
willl have:

html.php:
<?
  $Images = array('file1.jpg', 'file2.jpg');

  foreach($Images as $img) {
    echo "<img src=\"/showimage.php?file=$img\"><br>";
  }
?>

showimage.php
<?
$file = $_GET['file'];
if (file_exists($file) ) {
 header('Content-Yype: image/jpeg');
 readfile($file);
} else {
 header('Content-Yype: text/html');
 echo "Error 404";
}
?>



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

Reply via email to