[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cgi-list
Subject:    [CGI] Re: display content-type: image/gif
From:       Bert van Sas <DdO () cable ! a2000 ! nl>
Date:       1998-11-26 15:34:23
[Download RAW message or body]

yes

..
binmode IMAGE;
...

and it's okay..

ebrt


Bert van Sas wrote:
> 
> hi
> 
> the below code is from oReilly's CGI Programming (ch03)
> 
> ..but I only get the upper 50% of the picture..!
> 
> allready tried flushing the buffer etc..
> 
> $image = 'testPic.gif';
> if (open (IMAGE, "<" . $image)) {

binmode IMAGE;

>         $no_bytes = (stat ($image))[7];
>         $piece_size = $no_bytes / 10;
>         print "Content-type: image/gif", "\n";
>         print "Content-length: $no_bytes", "\n\n";
>         for ($loop=0; $loop <= $no_bytes; $loop += $piece_size) {
>                 read (IMAGE, $data, $piece_size);
>             print $data;
>         }
>          close (IMAGE);
> } else {
>         print "Content-type: text/plain", "\n\n";
>         print "Sorry! I cannot open the file $image!", "\n";
> }
> exit (0);
> 
> hope anybody can help me..!
> thanx
> bert
> 
> --
> 
> Bert van Sas / Webdeveloper @ DdO
> =================================
> PoBox 75357  / 1070 AJ  Amsterdam
> The Netherlands / avsas@xs4all.nl
> Telephone:   00 31 (0)20 676 1089
> Office email:  DdO@cable.a2000.nl

-- 

Bert van Sas / Webdeveloper @ DdO
=================================
PoBox 75357  / 1070 AJ  Amsterdam
The Netherlands / avsas@xs4all.nl
Telephone:   00 31 (0)20 676 1089 
Office email:  DdO@cable.a2000.nl
-----------------------------------------------------------------
To unsubscribe, send mail to "majordomo@jann.com" with "unsubscribe cgi-list"
in the body.

The CGI Tips & Tricks website (and archive of the list) is located
at http://www.jann.com/Perl/

cgi-list is hosted by Summit Communication Design (http://www.summitdesign.net).

Summit Communication Design is a full-service web hosting firm
providing web design, cgi programming and inter/intra-net support.
-----------------------------------------------------------------

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic