public function testConstruct() { $exif = new Image\Exif([]); $type = Image\Type::getById(IMAGETYPE_JPEG); $info = new Image\Info(new Image\Dimensions(1024, 768), $type, 2, 7, 'Marcel Marceau', $exif); $this->assertInstanceOf(Image\Info::class, $info); }
/** * Get an image. * * @param string $filename * * @return \Bolt\Filesystem\Handler\Image */ public function imageInfo($filename) { $image = $this->app['filesystem']->getImage('files://' . $filename); if (!$image->exists()) { return new Info(new Dimensions(0, 0), Type::getById(IMAGETYPE_UNKNOWN), 0, 0, null, new Exif([])); } return $image->getInfo(); }
public function testToString() { $type = Type::getById(IMAGETYPE_JPEG); $this->assertSame('JPEG', $type->toString()); $this->assertSame('JPEG', (string) $type); }
/** * {@inheritdoc} */ public function unserialize($serialized) { $data = unserialize($serialized); $this->dimensions = new Dimensions($data['dims'][0], $data['dims'][1]); $this->type = Type::getById($data['type']); $this->bits = $data['bits']; $this->channels = $data['channels']; $this->mime = $data['mime']; $this->exif = new Exif($data['exif']); }
/** * @param array $info * @param Exif $exif * * @return Info */ protected static function createFromArray(array $info, Exif $exif) { // Add defaults to skip isset checks $info += [0 => 0, 1 => 0, 2 => 0, 'bits' => 0, 'channels' => 0, 'mime' => '']; return new static(new Dimensions($info[0], $info[1]), Type::getById($info[2]), $info['bits'], $info['channels'], $info['mime'], $exif); }