Re: displaying a TIFF file

From: Date: Tue, 12 Nov 2002 23:49:46 +0000
Subject: Re: displaying a TIFF file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-124100@lists.php.net to get a copy of this message
At 00:36 13.11.2002, Joseph Szobody said: --------------------[snip]-------------------- >Folks... when I execute the following code, I get a big black nothing. I >think it's the right size, but all black. No image is showing up. What gives? > > >Header("Content-type: image/tiff"); > >$filename = image.tif >$file = fopen("$filename",rb); >fpassthru($file); >fclose($file); --------------------[snip]-------------------- You get a syntax error, but the browser cannot display it due to the MIME type. You need to quote the filename (would read "imagetif" if unquoted), and put a semicolon after the assignment. $filename = 'image.tif'; $file = fopen($filename,rb); // don't need quotes here if ($file) { // should always check if the file exists Header("Content-type: image/tiff"); fpassthru($file); fclose($file); } Using this sequence will send the MIME header only if the file is available and could be opened. -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/

« previous php.general (#124100) next »