/** * @param string $source * @param string $target * @param int $width * @param int $height * @throws \Kisphp\ImageFileTypeNotAllowed */ protected function resizeImage($source, $target, $width, $height, $cutImage = false) { $img = new \Kisphp\ImageResizer(); $img->load($source); $img->setTarget($target); $img->resize($width, $height, $cutImage); // ob_clean(); // ob_start(); // $img->display(true); // ob_clean(); // dump(headers_list()); // die; $img->save(); }
/** * @dataProvider getDimensionsToOriginal * * @throws \Kisphp\ImageFileTypeNotAllowed */ public function testOriginalDimensions($width, $height) { $source = __DIR__ . self::IMAGES_DIR . '/300x200.jpg'; $target = __DIR__ . self::IMAGES_DIR . '/th-dummy.jpg'; $im = new \Kisphp\ImageResizer(); $im->load($source); $im->setTarget($target); $im->resize($width, $height); $im->save(); $size = getimagesize($target); $this->assertEquals(300, $size[0]); $this->assertEquals(200, $size[1]); unlink($target); }