/**
  * 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');
 }
Ejemplo n.º 2
0
<?php

use imagemanipulation\ImageImageResource;
use imagemanipulation\thumbnail\Thumbalizer;
use imagemanipulation\thumbnail\pixelstrategy\CenteredPixelStrategy;
use imagemanipulation\ImageType;
// create the image resource
$resource = new ImageImageResource(new \SplFileInfo(__DIR__ . DIRECTORY_SEPARATOR . 'uglydog.png'));
// create the thumbnail
$thumbalizer = new Thumbalizer(new CenteredPixelStrategy(500, 200));
$thumb = $thumbalizer->create($resource);
// render the thumb
$thumb->render(ImageType::PNG, 80);
Ejemplo n.º 3
0
 public function thumbSquare($width)
 {
     $t = new Thumbalizer(new CenteredPixelStrategy($width, $width));
     $t->create($this->res);
     return $this;
 }
Ejemplo n.º 4
0
<?php

use imagemanipulation\ImageImageResource;
use imagemanipulation\ImageType;
use imagemanipulation\repeater\ImageRepeater;
use imagemanipulation\thumbnail\Thumbalizer;
use imagemanipulation\thumbnail\pixelstrategy\PercentagePixelStrategy;
// create the image resource
$resource = new ImageImageResource(new \SplFileInfo(__DIR__ . DIRECTORY_SEPARATOR . 'uglydog.png'));
// make the image a bit smaller before repeating it
$thumb = new Thumbalizer(new PercentagePixelStrategy(50));
$smallResource = $thumb->create($resource);
// create a grid of 2 x 2 ugly dogs
$repeater = new ImageRepeater($smallResource, $smallResource->getWidth() * 2, $smallResource->getHeight() * 2);
$repeated = $repeater->apply();
$repeated->render(ImageType::PNG, 80);