Michel,

from what you describe below, this sounds very unlikely to be a perl or 
mod_perl issue.
If I have to make a guess, I would say that what you download via perl/mod_perl is just not the same image file as what you think you download. Maybe it is a thumbnail version of the original image ?

For start, add this after "    binmode($in);"

warn "About to return file <$fname>, size : " . -s $fname;

and then have a look at your webserver error log, to see if it is what you 
expect.

Michel Jansen wrote:
Hi There,

Somehow images get corrupted when i read and then download them with a modperl script using File::Read or File::Slurp. The images are not really broken but they get blurred and dont look like before they are uploaded. When i download them directly from the webserver directory where they are stored they are ok.

I have also tried the script below but no success.

<-->

print $args->{base}->{CGI}->header( -type => $mimetype, -attachment => $document );

    my $fname = $file;

    open my $in, q{<}, $fname or die qq{Could not open file <$fname>: $!};
    binmode($in);

    open my $out, q{>&STDOUT} or die qq{Cant dup STDOUT: $!};
    binmode($out);
    $out->autoflush(1);

    my ($more, $buf);
    do{
        $more = read $in, $buf, 4096;
        print $out $buf;
    } while $more;

    close $out or die $!;
    close $in  or die $!;

<-->

Any hints that can help me out....?

Thanx in advance!

Michel


Reply via email to