<?php
$handle = imagick_readimage( getcwd() . "/image.jpg" ) ;
if ( imagick_iserror( $handle ) )
{
$reason = imagick_failedreason( $handle ) ;
$description = imagick_faileddescription( $handle ) ;
print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ;
exit ;
}
if ( !( $image_data = imagick_image2blob( $handle ) ) )
{
$reason = imagick_failedreason( $handle ) ;
$description = imagick_faileddescription( $handle ) ;
print "imagick_image2blob() failed<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n" ;
exit ;
}
header( "Content-type: " . imagick_getmimetype( $handle ) ) ;
print $image_data ;
?>