/** * Proportional Resize * * Resizes an Image while mantaining aspect ratio (not distorcing the image). * Because of Aspect Ration constrains, the final image might not have the * specified size, but it will have the closest possible without distorcing * the image. */ public function test() { $phMagick = new \phMagick\Core\Runner(); $resizeAction = new \phMagick\Action\Resize\Proportional($this->originalFile, $this->newFile); $resizeAction->setWidth(100); $phMagick->run($resizeAction); }
public function test() { $phMagick = new \phMagick\Core\Runner(); $resizeAction = new \phMagick\Action\Resize\Stretch($this->originalFile, $this->newFile); $resizeAction->setWidth(50); $resizeAction->setHeight(200); $phMagick->run($resizeAction); }
/** * Converts an image into another format. * * You can use this command to convert a file into another. * phMagick is smart, so it will guess the correct format from the file extension * optionaly you can optimize the image (striping exif tags) and set the final * image quality * */ public function test() { $phMagick = new \phMagick\Core\Runner(); $action = new \phMagick\Action\Convert($this->originalFile, $this->newFile); // optimize the image $action->optimize(); // sets image quality $action->quality(70); // execute the convert action $phMagick->run($action); }
public function test() { $phMagick = new \phMagick\Core\Runner(); $action = new \phMagick\Action\SimpleCrop($this->originalFile, $this->newFile); $action->setWidth(70); $action->setHeight(100); $action->setTop(0); $action->setLeft(0); $action->setGravity('center'); $phMagick->run($action); }
public function test() { $phMagick = new \phMagick\Core\Runner(); $action = new \phMagick\Action\Watermark($this->originalFile, $this->newFile); // transparency of the watermark $action->setTransparency(70); // location of the watermark $action->setGravity('center'); // watermark image (the image to overlay) $action->setWatermarkImage('data/watermark.png'); $phMagick->run($action); }