Re: Fopen image and print as binary/Image

From: Date: Tue, 27 Feb 2001 23:34:45 +0000
Subject: Re: Fopen image and print as binary/Image
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-41913@lists.php.net to get a copy of this message
> <? > header( "Content-type: image/gif" ); > > $img = fopen($DOCUMENT_ROOT . "/store/include/TestingImage.gif","rb"); > print($img); > ?> > prints this: > Resource id #1 > I'm trying to print the image as binary or as an image. Have I missed a > step? Hope i'm not being too confusing. $img is a "file pointer" -- It is simply a "reference" you can use to get stuff out of a file: while (!feof($img)){ $image_data = fread($img, 1000000); print($image_data); } However, you should be using passthru() instead, since that's pretty much what it was designed for. -- Visit the Zend Store at http://www.zend.com/store/ Wanna help me out? Like Music? Buy a CD: http://l-i-e.com/artists.htm Volunteer a little time: http://chatmusic.com/volunteer.htm

« previous php.general (#41913) next »