public function setup() { $this->fs = new Filesystem(new Local(__DIR__ . '/images')); $this->logoJpg = $this->fs->getImage('generic-logo.jpg'); $this->landscapeImage = $this->fs->getImage('samples/sample1.jpg'); $this->portraitImage = $this->fs->getImage('samples/sample2.jpg'); }
public function testExifOrientation() { $images = array('1-top-left', '2-top-right', '3-bottom-right', '4-bottom-left', '5-left-top', '6-right-top', '7-right-bottom', '8-left-bottom'); $expected = new Dimensions(400, 200); foreach ($images as $name) { $image = $this->fs->getImage('exif-orientation/' . $name . '.jpg'); $resource = ImageResource::createFromString($image->read()); $this->assertDimensions($expected, $resource->getDimensions()); $color = $resource->getColorAt(new Point()); $this->assertTrue($color->getRed() > 250 && $color->getGreen() < 10 && $color->getBlue() < 5, 'Wrong orientation'); } }
public function setup() { $samples = new Filesystem\Filesystem(new Local(__DIR__ . '/images/samples')); $subdir = new Filesystem\Filesystem(new Local(__DIR__ . '/images/subdir')); $images = new Filesystem\Filesystem(new Local(__DIR__ . '/images')); $filesystems = ['samples' => $samples, 'subdir' => $subdir, 'images' => $images]; $this->fs = new Filesystem\Manager($filesystems); $default = $images->getImage('samples/sample1.jpg'); $this->finder = new Finder($this->fs, array_keys($filesystems), $default); }