Re: Streaming a jpg
| From: | Todd Cary | Date: | Fri, 10 Aug 2001 22:54:14 +0000 |
| Subject: | Re: Streaming a jpg | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-62233@lists.php.net to get a copy of this message | ||
Matthew -
The following script just gives me a blank image holder. Am I missing
something simple?
Todd
<?php
header("Content-Type: image/jpeg");
$filename = "test.jpg";
$fd = fopen($filename, "r");
if ($fd) {
$contents = fread ($fd, filesize ($filename));
print($contents);
fclose($fd);
} else {
print("Cannot open file<br>");
}
?>
This works:
<?php
// Read a text file
$filename = "test.txt";
$fd = fopen($filename, "r");
if ($fd) {
$contents = fread ($fd, filesize ($filename));
print($contents);
fclose($fd);
} else {
print("Cannot open file<br>");
}
?>
--
Todd Cary
Ariste Software
todd@aristesoftware.com