public function testAutoOrient() { $excepted = Helper::getExpected(__FUNCTION__ . '.jpg'); $actual = Helper::getActual(__FUNCTION__ . '.jpg'); $original = Helper::getOrig('butterfly.jpg'); $img = new Image(); $img->loadFile($original)->autoOrient()->saveAs($actual); Helper::isFileEq($actual, $excepted); }
public function testIssue8() { $excepted = Helper::getExpected(__FUNCTION__ . '.png'); $actual = Helper::getActual(__FUNCTION__ . '.png'); $base = Helper::getOrig('issue-8/original.png'); $img = new Image($base); if ($img->getHeight() != $img->getWidth()) { if ($img->getWidth() < 175) { $img->fitToWidth($img->getWidth()); } else { $img->fitToWidth(175); } } else { $img->bestFit(175, 175); } $img->saveAs($actual); Helper::isFileEq($actual, $excepted); }
public function testBorderColorSize() { $excepted = Helper::getExpected(__FUNCTION__ . '.png'); $actual = Helper::getActual(__FUNCTION__ . '.png'); $original = Helper::getOrig('butterfly.jpg'); $img = new Image(); $img->loadFile($original)->addFilter('border', array('color' => 'ff0', 'size' => '5'))->saveAs($actual); Helper::isFileEq($actual, $excepted); }
public function testWatermark() { $excepted = Helper::getExpected(__FUNCTION__ . '.png'); $actual = Helper::getActual(__FUNCTION__ . '.png'); $original = Helper::getOrig('butterfly.jpg'); $overlay = Helper::getOrig('overlay.png'); $img = new Image(); $img->loadFile($original)->overlay($overlay)->saveAs($actual); Helper::isFileEq($actual, $excepted); }
public function testFlipRorateRevert275White() { $excepted = Helper::getExpected(__FUNCTION__ . '.png'); $actual = Helper::getActual(__FUNCTION__ . '.png'); $original = Helper::getOrig('butterfly.jpg'); $img = new Image(); $img->loadFile($original)->addFilter('rotate', -275, array(255, 255, 255, 127))->saveAs($actual); Helper::isFileEq($actual, $excepted); }
public function testTextStrokeDisableColors() { $excepted = Helper::getExpected(__FUNCTION__ . '.jpg'); $actual = Helper::getActual(__FUNCTION__ . '.jpg'); $original = Helper::getOrig('butterfly.jpg'); $font = Helper::getOrig('font.ttf'); $img = new Image($original); $img->addFilter('text', 'Nice Butterfly', $font, array('stroke-size' => null, 'stroke-color' => null, 'color' => array('#f00', '#ff7f00', '#ff0', '#0f0', '#0ff', '#f0f')))->saveAs($actual); Helper::isFileEq($actual, $excepted); }
public function testOpenImageResource() { $original = Helper::getOrig('butterfly.jpg'); $actual = Helper::getActual(__FUNCTION__ . '.jpg'); $excepted = Helper::getExpected(__FUNCTION__ . '.jpg'); $imgRes = imagecreatefromjpeg($original); $img = new Image($imgRes); $img->saveAs($actual); Helper::isFileEq($actual, $excepted); }
public function testBestFitNoChange() { $excepted = Helper::getExpected(__FUNCTION__ . '.png'); $actual = Helper::getActual(__FUNCTION__ . '.png'); $original = Helper::getOrig('butterfly.jpg'); $img = new Image(); $img->loadFile($original)->bestFit(10000, 10000)->saveAs($actual); Helper::isFileEq($actual, $excepted); }