On Wed, Jun 05, 2002 at 04:38:26PM +0200, [EMAIL PROTECTED] wrote:
> Hello, 
> 
> I have a problem with setting the correct content-type under mod_perl
> with mason. I use mason with the mod_perl args_method.
> I want to get a .gif out of a database and print it
> in a window, but all i get is binary junk. I tried to set the correct
> content-type but when i look at the page source i can't see it. 
> 
> Here the relevant extract from my source: 
> 
> my $sth = $db->prepare("select attachment from table");
> $sth->execute();
> # following three lines should set content-type
> #$r->header_out('Content-Type' => 'image/gif');
> #$r->headers_out->add('Content-Type' => 'image/gif');
> $r->content_type("image/gif");
> my ($att) = $sth->fetchrow_array();
> $m->out($att); 
> 

You're real close here....

$r->content_type("image/gif");
$r->send_http_header;
$r->print($att);
$m->abort(200);





> What am i doing wrong? 
> 

You actually need to bypass mason for this.  It's unfortunate that mason 
doesn't have some better image content type recoginition and do the right
thing (hint, hint :).

Rob

Reply via email to