/** * https://github.com/elgervb/imagemanipulation/issues/26 */ public function testTooLargeY() { $res = ImageGenerator::create(826, 1251, new Color('#999')); $thumbilizer = new Thumbalizer(new MaxPixelStrategy(250, 250)); $thumb = $thumbilizer->create($res); $this->assertEquals(165, $thumb->getX(), 'Checking image width'); $this->assertEquals(250, $thumb->getY(), 'Checking image height'); }
public function testCreate() { $width = 250; $height = 750; $color = 'ff00ff'; $res = ImageGenerator::create($width, $height, new Color($color)); $this->assertEquals($width, $res->getWidth()); $this->assertEquals($height, $res->getHeight()); $this->assertEquals($color, ColorUtil::getColorAt($res, Coordinate::create(0, 0))->getHexColor()); $this->assertEquals($color, ColorUtil::getColorAt($res, Coordinate::create($width / 2, $height / 2))->getHexColor()); $this->assertEquals($color, ColorUtil::getColorAt($res, Coordinate::create($width - 1, $height - 1))->getHexColor()); }
<?php use imagemanipulation\generation\ImageGenerator; use imagemanipulation\ImageType; use imagemanipulation\color\Color; ImageGenerator::create(500, 200, new Color('#747474'))->render(ImageType::PNG, 80);