Get the info of only one image

@param string     $image
@param null|array $config

@return array|null
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;
    }
308925
public function setImageManager(ImageManager $imageManager = null, array $config = [])
    {
        if (!$imageManager) {
            $imageManager = new ImageManager($config);
        }
        $this->imageManager = $imageManager;

        return $this;
    }
191004
public function checkArrayOfType(array $config)
    {
        if (\count($config) === 1 && isset($config[0])) {
            $type = $this->createType($config[0]);
            return $this->createArrayOfType($type);
        }
        return null;
    }
527732
public function getFirstImage()
    {
        $images = $this->getImage();
        if ($images) {
            foreach ($images as $image) {
                return $image;
            }
        }

        return null;
    }
313173
protected function fetchImage($image) {
    $value = NULL;
    $files = $this->fileStorage->loadByProperties([
      'uuid' => $image,
    ]);

    if ($files) {
      return current($files);
    }

    return $value;
  }
509314
public function apply( $image ) {

        imagefilter($image->getCore(), IMG_FILTER_PIXELATE, $this->amount, true);
        return $image;
    }
468765
public function apply( $image ) {

        $image->getCore()->sigmoidalContrastImage($this->amount > 0, $this->amount / 4, 0);
        return $image;
    }
404412
public function allocate($image): int {
        if ($image instanceof Image) {
            $image = $image->getResource();
        }

        return imagecolorallocatealpha(
            $image,
            $this->r,
            $this->g,
            $this->b,
            $this->a
        );
    }
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;
    }
373186
public static function getImageLoader(ConfigObject $config)
    {
        $lib = self::getLibrary();

        /** @var ImageLoaderInterface $libInstance */
        $instance = self::factory($lib, ImageLoaderInterface::class, [$config]);

        if (!self::isInstanceOf($instance, ImageLoaderInterface::class)) {
            throw new ImageException('The message library must implement "' . ImageLoaderInterface::class . '".');
        }

        return $instance;
    }
675576
public static function getIcons(array $config = []): array
    {
        $result = [];

        $requiredIconParams = [
            'url',
            'pattern',
            'default'
        ];

        // passing default icons if no external config present.
        $config = empty($config) ? Configure::read('Icons') : $config;

        if (empty($config)) {
            return $result;
        }

        $diff = array_diff($requiredIconParams, array_keys($config));
        if (!empty($diff)) {
            return $result;
        }

        $data = file_get_contents($config['url']);
        $data = $data ?: '';
        preg_match_all($config['pattern'], $data, $matches);

        if (empty($matches[1])) {
            return $result;
        }

        $result = array_unique($matches[1]);

        if (!empty($config['ignored'])) {
            $result = array_diff($result, $config['ignored']);
        }
        sort($result);

        return $result;
    }
254760
protected function received(Image $image, Slice $config, $minimal = true): Slice
    {
        $width  = (int)$config->getRequired('width');
        $height = (int)$config->getRequired('height');

        $shiftWidth  = 0;
        $shiftHeight = 0;

        $_width  = $width;
        $_height = $height;

        if ($image->height() < $image->width())
        {
            $_height     = $image->height() * $width / $image->width();
            $shiftHeight = ($_height - $height) / 2;
        }
        else
        {
            $_width     = $image->width() * $height / $image->height();
            $shiftWidth = ($_width - $width) / 2;
        }

        if ($minimal ^ $_width > $width)
        {
            $_height = $_height * $width / $_width;
            $_width  = $width;
        }

        if ($minimal ^ $_height > $height)
        {
            $_width  = $_width * $height / $_height;
            $_height = $height;
        }

        return new Slice([
            'config'   => [
                'width'  => $width,
                'height' => $height,
            ],
            'received' => [
                'width'  => (int)$_width,
                'height' => (int)$_height,
            ],
            'shift'    => [
                'width'  => (int)$shiftWidth,
                'height' => (int)$shiftHeight,
            ]
        ]);
    }
293543
public function apply( $image ) {

        imagefilter($image->getCore(), IMG_FILTER_COLORIZE, $this->red, $this->green, $this->blue);
        return $image;
    }
780220
public function Image($Img = FALSE) {
      if ($Img) {
         if (!is_array($Img))
            $Img = array($Img);

         $CurrentImages = $this->Data('_Images');
         if (!is_array($CurrentImages))
            $this->SetData('_Images', $Img);
         else {
            $Images = array_unique(array_merge($CurrentImages, $Img));
            $this->SetData('_Images', $Images);
         }
      }
      $Images = $this->Data('_Images');
      return is_array($Images) ? $Images : array();
   }
776379
private static function getConfigValue($key, $config)
    {
        $config = ($config && is_array($config)) ? $config : BlockCypherConfigManager::getInstance()->getConfigHashmap();
        return (array_key_exists($key, $config)) ? trim($config[$key]) : null;
    }
496615
public function getImageCaption($image): ?string
    {
        if (null === ($file = $this->container->get('huh.utils.file')->getFileFromUuid($image))) {
            return null;
        }

        $meta = StringUtil::deserialize($file->getModel()->meta, true);

        if (!isset($meta[$GLOBALS['TL_LANGUAGE']]['caption'])) {
            return null;
        }

        return $meta[$GLOBALS['TL_LANGUAGE']]['caption'];
    }
204814
private function getConstraint(array $config)
    {
        $options = array(
            'maxSize' => '5M',
            'mimeTypes' => $config['mime_types'],
            'maxHeight' => $config['max_height'],
            'maxWidth' => $config['max_width'],
            'minHeight' => $config['min_height'],
            'minWidth' => $config['min_width'],
        );

        return new Assert\Image($options);
    }