Code: Select all
<?php
$ptrn=NewMagickWand();
MagickReadImage($ptrn,'pattern.tif');
$pw=NewPixelWand();
PixelSetColor($pw,'black');
PixelSetAlpha($pw,0);
PixelSetOpacity($pw,0);
// only for test purposes - this transfomation works.
MagickShearImage($ptrn,$pw,15,0);
// only for test purposes - this transformation works on linux and hangs php on windows.
MagickRotateImage($ptrn,$pw,45);
$atdw=NewDrawingWand();
DrawAffine($atdw,
floatval($_GET['sx']),
floatval($_GET['sy']),
floatval($_GET['rx']),
floatval($_GET['ry']),
floatval($_GET['tx']),
floatval($_GET['ty']));
if (WandHasException($atdw)) // it also works and didn't show an error
{
$r=DrawGetException($atdw);
print_r($r);exit;
};
$r=MagickAffineTransformImage($ptrn,$atdw); //this does nothing and no errorcode returns...
if (!$r||WandHasException($ptrn))
{
echo MagickGetExceptionString($ptrn);
exit;
};
//MagickCompositeImage($ptrn,$mw,MW_OverCompositeOp,0,0); /// old code fragment, there was some image compositing, it works good
$nw=$ptrn;
if (!$nw)
{
echo MagickGetExceptionString($nw);
exit;
};
MagickSetImageFormat($nw,'JPG');
MagickEchoImageBlob($nw);
?>