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

        ~Chris                           /"\
                                         \ /     Pine Ribbon Campaign
Microsoft Security Specialist             X      Against Outlook
The moron in Oxymoron.                   / \     http://www.thebackrow.net

PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to