#!/usr/local/bin/php
<?php
function &checkWandError(&$result, $wand, $line) {
if ($result === FALSE && WandHasException($wand)) {
echo '<pre>An error occurred on line ', $line, ': ', WandGetExceptionString($wand), '</pre>';
exit();
}
return $result;
}
function addText($drw_wnd, $pxl_wnd, $font_size, $text, $gravity = MW_CenterGravity, $x = 0, $y = 0) {
/* Set the color used to draw shapes and text with $drw_wnd to $pxl_wnd's
color
*/
DrawSetFillColor($drw_wnd, $pxl_wnd);
/* Set the text font size used by $drw_wnd to $font_size */
DrawSetFontSize($drw_wnd, $font_size);
/* Set $drw_wnd text gravity (automatic text positioning setting), to
$gravity
*/
DrawSetGravity($drw_wnd, $gravity);
/* Add a command to the $drw_wnd DrawingWand to draw the $text string at
point ($x, $y) (relative to $drw_wnd's gravity setting).
*/
DrawAnnotation($drw_wnd, $x, $y, $text);
}
echo exec('whoami');
$mgck_wnd = NewMagickWand(); /* Create a new MagickWand resource -- "holds"
the images */
$drw_wnd = NewDrawingWand();
$bg_color= NewPixelWand(); /* Creates a new PixelWand resource -- contains
information on an individual unit of color;
opaque black by default */
$white = NewPixelWand('white'); /* Does the same as above, except that the
PixelWand's color is set to white */
$width = 64;
$height = 64;
$blah = MagickNewImage($mgck_wnd, $width, $height, $bg_color);
$white = NewPixelWand('white');
//$pre_morph_wnd =& checkWandError(MagickGetImage($mgck_wnd), $mgck_wnd, __LINE__);
$text = "(blank";
if (isset($_GET['text'])) {
$text = $_GET['text'];
} else {
echo 0;
}
addText($drw_wnd, $white, 12, $text);
MagickDrawImage($mgck_wnd, $drw_wnd);
MagickSetFormat($mgck_wnd, 'GIF');
checkWandError(MagickWriteImages($mgck_wnd,"sku/image.gif", true), $mgck_wnd, __LINE__);
DestroyMagickWand($mgck_wnd);
?>
--
MattWalsh - 27 Aug 2006