Click to See Complete Forum and Search --> : Problem in Writing image content to .jpg file


rhytha
05-03-2007, 08:00 AM
Hi devs,

we have a problem in storing image data to a file in scraper script. the scraper fetching image data from site url and the data will be stored in a jpg file by cration a new .jpg file and writing the image data to that file. All are working fine and the .jpg file also created but i cant view that image.

the following is the code i have used to create .jpg file

my $image = $content->{CONTENT};
$tmpname=$item->{F->{ITEM_ID}}."_".$i.".jpg";

open (FILEHANDLE, "> ".$tmpname) or plog('info', 'failed to create file');
binmode(FILEHANDLE);
print FILEHANDLE "$image";
close(FILEHANDLE);

Plz help me out.:confused:

Thankx in advance

Scriptage
05-07-2007, 08:58 AM
Try adding:

binmode(STDOUT);

before you print.

rhytha
05-08-2007, 12:43 AM
i used binmode in that code. just look at my code.

binmode(FILEHANDLE);

binmode doesn't work with linux box :( .