Re: fgets

From: Date: Wed, 29 Aug 2001 21:45:53 +0000
Subject: Re: fgets
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-65116@lists.php.net to get a copy of this message
On Wed, 29 Aug 2001, Joseph Bannon wrote: > I want to use fgets to get an image off the server and then print it. Kinda > like if you call the script picture.php, an image will appear. How do I do I do this, with fopen() and fpassthru() ... $im = fopen( "myImage.jpg", "r" ); if( !$im ){ // FILE WASN'T FOUND } else { // ALL GOOD - SEND IT TO THE BROWSER fpassthru( $im ); } fclose( $im ); For the sake of simplicity, I left off additional error checking I do ... but this is the core of the idea. The image functions (http://www.php.net/manual/en/ref.image.php) work well too. When just pushing out an unmodified image, the above code has proven simplest for me. ~Chris /"\ \ / Pine Ribbon Campaign Microsoft Security Specialist X Against Outlook The moron in Oxymoron. / \ http://www.thebackrow.net

« previous php.general (#65116) next »