Fetch the metadata for a given image

@param ImageInterface $image

@return string JSON encoded response
540626
public function imageWithMetadataAction(ImageInterface $image)
    {
        $this->response->setHeader('Content-Type', 'application/json');
        $imageProperties = $this->getImageInterfacePreviewData($image);

        return json_encode($imageProperties);
    }
1063367
public function getMetadataUrl($imageIdentifier) {
        $url = sprintf(
            $this->getHostForImageIdentifier($imageIdentifier) . '/users/%s/images/%s/metadata.json',
            $this->getUser(),
            $imageIdentifier
        );

        return Http\MetadataUrl::factory(
            $url,
            $this->getConfig('privateKey'),
            $this->getPublicKey()
        );
    }
244384
private function getImagePathname(AbstractImage $image)
    {
        return $this->storage->resolvePath($image, AbstractImage::PROPERTY_FILE, ClassUtils::getClass($image));
    }
608191
private function getImageType($image) {
        if (function_exists('exif_imagetype')) {
            return exif_imagetype($image);
        } else {
            try {
                $info = getimagesize($image);
                return $info ? $info[ 2 ] : false;
            } catch (\Exception $e) {
                return false;
            }
        }
    }
357880
public function getImageInfo($image)
    {
        if ( empty($image) || !file_exists($image))
        {
            throw new \InvalidArgumentException('Image file not found.');
        }

        $pathInfo = pathinfo($image);
        $info     = getimagesize($image);

        if ( !in_array($pathInfo['extension'], $this->types) )
        {
            throw new \InvalidArgumentException('Unsupported image file extension.');
        }

        $info['width']    = $info[0];
        $info['height']   = $info[1];
        $info['ext']      = $info['type'] = $pathInfo['extension'];
        $info['size']     = filesize($image);
        $info['dir']      = $pathInfo['dirname'];
        $info['path']     = str_replace('/', DIRECTORY_SEPARATOR, $image);
        $info['fullname'] = $pathInfo['basename'];
        $info['filename'] = $pathInfo['filename'];
        $info['type']     = ($info['type'] == 'jpg') ? 'jpeg' : $info['type'];

        return $info;
    }
462708
def get_metadata(self):
        
        if self._metadata is None:
            self._metadata = ImageMetadata()
        inspect_to_metadata(self._metadata, self.inspect(refresh=True))
        return self._metadata
1360309
protected function handleImageManipulation(ImageInterface $image, array $data): ImageInterface
    {
        $width = $height = $data['dimension'];

        return $image->thumbnail(new Box($width, $height), $data['mode'], $data['filter']);
    }
3114
public static function getImageInfo($image, array $config = null)
    {
        $finfo = finfo_open(FILEINFO_MIME_TYPE);
        $img = new static($image['value'], $finfo, $config);

        $curl = $img->getConnection();
        curl_exec($curl);
        curl_close($curl);

        $info = $img->getInfo();

        finfo_close($finfo);

        return $info;
    }
595605
public function getImage(EventInterface $event) {
        $request = $event->getRequest();
        $response = $event->getResponse();
        $eventManager = $event->getManager();

        $user = $request->getUser();
        $imageIdentifier = $request->getImageIdentifier();

        $image = new Model\Image();
        $image->setImageIdentifier($imageIdentifier)
              ->setUser($user);

        $response->setModel($image);

        // Load image details from database
        $eventManager->trigger('db.image.load');

        // Set a long max age as the image itself won't change
        $response->setMaxAge(31536000);

        // Custom Imbo headers, based on original
        $response->headers->add([
            'X-Imbo-OriginalMimeType' => $image->getMimeType(),
            'X-Imbo-OriginalWidth' => $image->getWidth(),
            'X-Imbo-OriginalHeight' => $image->getHeight(),
            'X-Imbo-OriginalFileSize' => $image->getFilesize(),
            'X-Imbo-OriginalExtension' => $image->getExtension(),
        ]);

        // Trigger loading of the image
        $eventManager->trigger('storage.image.load');

        // Trigger possible image transformations
        $eventManager->trigger('image.transform');
    }
773407
public function getMetaData($key)
    {
        return isset($this->meta[$key]) ? $this->meta[$key] : null;
    }
1234692
public function addImage(\Elcodi\Component\Media\Entity\Interfaces\ImageInterface $image)
    {
        $this->images->add($image);

        return $this;
    }
330830
public function getMetaData($key)
    {
        if (!isset($this->metaData[$key])) {
            return false;
        }
        
        return $this->metaData[$key];
    }
1203414
public function loadToString($image)
    {
        $srcStorage = $this->getImageStorage($image);
        if ($srcStorage !== DriverInterface::IMAGE_STORAGE_STRING) {
            $image = @file_get_contents($image);
            if (false === $image) {
                throw new Exception\RuntimeException('could not load image');
            }
        }
        return $image;
    }
713004
public function image($image)
    {
        $filePaths = loader()->getPublicDirs(true);
        $image = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $image);

        foreach ($filePaths as $filePath) {
            $filePath .= 'img' . DIRECTORY_SEPARATOR;

            if (is_file($filePath . $image)) {
                return path_to_url($filePath . $image);
                break;
            }

            unset($filePath);
        }
    }
12014
private static function getMimeTypeOfImage($image)
    {
        static $mimes;
        if ($mimes === null) {
            $mimes = [
                'cod'  => 'image/cis-cod',
                'ras'  => 'image/cmu-raster',
                'fif'  => 'image/fif',
                'gif'  => 'image/gif',
                'ief'  => 'image/ief',
                'jpeg' => 'image/jpeg',
                'jpg'  => 'image/jpeg',
                'jpe'  => 'image/jpeg',
                'png'  => 'image/png',
                'tiff' => 'image/tiff',
                'tif'  => 'image/tiff',
                'mcf'  => 'image/vasa',
                'wbmp' => 'image/vnd.wap.wbmp',
                'fh4'  => 'image/x-freehand',
                'fh5'  => 'image/x-freehand',
                'fhc'  => 'image/x-freehand',
                'ico'  => 'image/x-icon',
                'pnm'  => 'image/x-portable-anymap',
                'pbm'  => 'image/x-portable-bitmap',
                'pgm'  => 'image/x-portable-graymap',
                'ppm'  => 'image/x-portable-pixmap',
                'rgb'  => 'image/x-rgb',
                'wxd'  => 'image/x-windowdump',
                'xbm'  => 'image/x-xbitmap',
                'xpm'  => 'image/x-xpixmap',
            ];
        }

        $ext = pathinfo($image, PATHINFO_EXTENSION);
        $type = isset($mimes[$ext]) ? $mimes[$ext] : 'application/octet-stream'; // RFC 2046 states in section 4.5.1: The "octet-stream" subtype is used to indicate that a body contains arbitrary binary data.

        return $type;
    }
1222239
public static function fetchArray(EntityInterface $entity): array
    {
        if(!defined(get_class($entity)."::FIELDS"))
            return [];
        elseif(is_array($entity::FIELDS))
            $fields = $entity::FIELDS;
        else
            $fields = json_decode($entity::FIELDS, true);

        $ret = [];
        foreach($fields as $key=>$value) {
            $ret[
                \Stringy\StaticStringy::upperCamelize($key)
            ] = $value;
        }
        
        return $ret;
    }
296055
public function apply(ImageInterface $image)
    {
        if (!$image instanceof Image) {
            throw new InvalidArgumentException("This filter is supported by Image Magick driver only!");
        }
        return $image->applyMask($this->shapeMask)->removeTransparency(new Color('fff'));
    }