Posted: 2007-01-24T22:13:58-07:00
I have used the following PHP to read, annotate and output an image...
just expand it to do what you want.
If you are using PHP MagickWand you can use...
If you are using PHP imagick PECL module you can do...
These are just some basic test scripts I wrote for testing a new PHP web module, which allows all three methods.
See also IM Examples, Feedback
Code: Select all
<?
header('Content-Type: image/gif');
system("convert -pointsize 72 -font Utopia-Italic \\
label:' - Font Test - ' gif:-");
?>
If you are using PHP MagickWand you can use...
Code: Select all
<?
// This is a test of the Raw MagickWand installation in PHP
// See http://www.ioncannon.net/php/61/php-imagemagick-magickwand-examples/
$image = NewMagickWand();
if( MagickReadImage( $image, 'image.png' ) ) {
header( 'Content-Type: image/jpeg' );
MagickSetImageFormat( $image, 'JPEG' );
MagickEchoImageBlob( $image );
} else {
echo "Error in MagickReadImage()";
echo MagickGetExceptionString($image);
}
?>
Code: Select all
<?
$handle = imagick_readimage( getcwd() . "/image.gif" ) ;
if ( imagick_iserror( $handle ) )
{
$reason = imagick_failedreason( $handle ) ;
$description = imagick_faileddescription( $handle ) ;
print "handle2 failed!<BR>\nReason: $reason<BR>\nDescription: $d
escription<BR>\n" ;
exit ;
}
$new_handle = imagick_getimagefromlist( $handle ) ;
header( "Content-type: " . imagick_getmimetype( $new_handle ) ) ;
print imagick_image2blob( $new_handle ) ;
?>
See also IM Examples, Feedback