...but my production server is giving me this:
The code that works on my development system is as follows:
Code: Select all
header('Content-type: image/png');
header('Content-Disposition: attachment; filename="test.png"');
$deformation = $_POST['deform'];
$amount = $_POST['amount'];
$encoded = $_POST['imgdata'];
$encoded = str_replace(' ', '+', $encoded);
$decoded = base64_decode($encoded);
echo $deformation($decoded,40);
function skewUp($image,$amount) {
$im = new Imagick();
$im->setBackgroundColor(new ImagickPixel('transparent'));
$im->readimageblob($image);
$im->setImageVirtualPixelMethod( imagick::VIRTUALPIXELMETHOD_BACKGROUND );
$im->trimImage(0);
$im->setImagePage(0, 0, 0, 0);
$x1 = $im->getImageWidth();
$x2 = $im->getImageWidth();
$y1 = $im->getImageHeight();
$y2 = $im->getImageHeight()/((100-$amount)*0.01);
$im->setGravity(imagick::GRAVITY_NORTH);
$im->extentImage ($x2,$y2,0,0);
$points = array(
0, 0, 0, $im->getImageHeight()-$y1, #top left
0, $y1, 0, $y2, #bottom left
$x1, 0, $x1, 0, #top right
$x1, $y1, $x1, $y1 #bottom right
);
$im->distortImage( Imagick::DISTORTION_BILINEAR, $points, TRUE );
$im->trimImage(0);
$im->setImagePage(0, 0, 0, 0);
return($im);
}