BlobToImage can not produce image from Oracle DB - help
Posted: 2011-08-29T11:06:34-07:00
Hi there,
I am reading Oracle database of BLOB (images..don't know what format those are but trying to read and want to display or store it in a file.
my $test_image;
my $image=Image::Magick->new(magick=>'jpg', size =>'640x480',depth=>72);
$sql = "select my_image from all_images_BLOB where id_pk = 123";
$sth = $dbh->prepare( $sql );
$sth->execute();
$sth->bind_columns(undef,\$test_image);
while($sth->fetch()) {
$image->BlobToImage($test_image);
$image->Write('example_out.jpg');
}
$sth->finish();
$dbh->disconnect();
Somehow, I get a file with 0 bytes.
But when change one line in above code:
$image->Write('example_out.jpg'); to $image->Write('example_out.bmp);
I get Image but its all black.
I really appreciate your help in this,
Thank you in advance,
SDJ
I am reading Oracle database of BLOB (images..don't know what format those are but trying to read and want to display or store it in a file.
my $test_image;
my $image=Image::Magick->new(magick=>'jpg', size =>'640x480',depth=>72);
$sql = "select my_image from all_images_BLOB where id_pk = 123";
$sth = $dbh->prepare( $sql );
$sth->execute();
$sth->bind_columns(undef,\$test_image);
while($sth->fetch()) {
$image->BlobToImage($test_image);
$image->Write('example_out.jpg');
}
$sth->finish();
$dbh->disconnect();
Somehow, I get a file with 0 bytes.
But when change one line in above code:
$image->Write('example_out.jpg'); to $image->Write('example_out.bmp);
I get Image but its all black.
I really appreciate your help in this,
Thank you in advance,
SDJ