Get image caption based on given path/uuid.

@param mixed $image File path/uuid

@return string|null Image caption if available, else 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'];
    }
69263
public function setImage(\Core\Entity\Image $image = null) {
        $this->image = $image;

        return $this;
    }
466520
public function thumbnailPath($image, $template)
    {
        if (!$image || !$template) {
            return '';
        }

        $parts = explode(';', $image);
        $fileId = $parts[0];

        $src = $this->router->generate('frontendmedia_thumbnail', ['fileId' => $fileId, 'template' => $template], UrlGeneratorInterface::ABSOLUTE_PATH);

        return $src;
    }
1250402
private function getFile(Image $image)
    {
        $file = $image->getFile();

        if ($file instanceof \SplFileInfo) {
            return $file;
        }

        $url = $image->getUrl();

        if (null !== $url) {
            return new File($this->downloadFile($url));
        }

        return null;
    }
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;
            }
        }
    }
1045245
public function decode($image = null) {
        try {
            
            if(is_array($image)) {
                $this->setArrayImages($image);

                if($this->_ARRAY_IMAGES == null) {
                    throw new \Exception("Nothing to decode");
                }

            } else {
                if(!file_exists($image)) {
                    throw new \Exception("File/Folder does not exist");
                }

                $this->setSingleImage($image);

                if($this->_SINGLE_IMAGE == null) {
                    throw new \Exception("Nothing to decode");
                }
            }

            $image = $this->prepare();

            if(empty($image)) {
                throw new \Exception("Is the java PATH set correctly ? Current Path set is : " . $this->getJavaPath());
            }

            // If the image is single then return the actual image
            if(count($image) == 1) {
                return current($image);
            }

            return $image;
        } catch(\Exception $e) {
            echo $e->getMessage();
        }
    }
766217
public function getImageClient($organization = null)
    {
        if (!$organization) {
            $organization = $this->configuration->getOrganizationName();
        }

        if (!array_key_exists($organization, $this->imageClient)) {
            $this->imageClient[$organization] = Factory::getImageClient(
                $organization,
                $this->configuration->getApiKey(),
                [Factory::API_BASE_URL => $this->configuration->getApiUri()]
            );
        }

        return $this->imageClient[$organization];
    }
564810
public static function getSystemImage($image, $dir = 'images')
	{
		$image = ltrim($image, DS);

		if (!self::isImage($image))
		{
			return $image;
		}

		$template = DS . 'core' . DS . 'templates' . DS . 'system';
		if ($t = self::app('template'))
		{
			$template = substr($t->path, strlen(PATH_ROOT));
		}

		$paths = array();
		$paths[] = $template . DS . 'html' . DS . 'system' . ($dir ? DS . $dir : '') . DS . $image;
		$paths[] = DS . 'core' . DS . 'assets' . DS . $dir . DS . $image;

		// Run through each path until we find one that works
		foreach ($paths as $path)
		{
			if (file_exists(PATH_ROOT . $path))
			{
				// Push script to the document
				return str_replace('/administrator', '', rtrim(Request::base(true), '/')) . $path;
			}
		}
	}
162239
public function execute($image)
    {
        $level = $this->argument(0)->between(-100, 100)->required()->value();

        return $image->getCore()->sigmoidalContrastImage($level > 0, $level / 4, 0);
    }
1126155
public function getFormat(Image $image)
    {
        $allowed = [
            'gif' => 'image/gif',
            'jpg' => 'image/jpeg',
            'pjpg' => 'image/jpeg',
            'png' => 'image/png',
            'webp' => 'image/webp',
        ];

        if (array_key_exists($this->fm, $allowed)) {
            return $this->fm;
        }

        if ($format = array_search($image->mime(), $allowed, true)) {
            return $format;
        }

        return 'jpg';
    }
351755
private function storeImage(Image $image)
    {
        $file = $this->getFile($image);

        if (!$file instanceof \SplFileInfo) {
            return null;
        }

        $path = $this->imageManagerInterface->store($file);

        return $image->setPath($path);
    }
435667
public function image($image, $width=null, $height=null, $alt=null, $class=null, $link=null, $caption=null, $srcset=null) {
		$image = $this->getLink($image);
		$attributes = $this->getHtmlAttributes(array(
			'width'=>$width,
			'height'=>$height,
			'alt'=>$alt,
			'caption'=>$caption,
			'class'=>$class,
			'srcset'=>$srcset
		));

		$img = "<img src='$image'$attributes />";
		if (!is_null($link)) {
			$link = $this->getLink($link);
			return "<a href='$link'>$img</a>";
		}

		return $img;
	}
407532
public function getUrl($image, $imageQuery = NULL)
    {
        // Experimental support for absolute picture url when is relative generator url set
        if($imageQuery && Strings::startsWith($imageQuery, '//'))
        {
            $imageQuery = Strings::substring($imageQuery, 2);
            $imageUrl   = $this->getPictureGeneratorUrl($image, $imageQuery);

            if($this->isUrlRelative)
            {
                if($this->websiteUrl)
                {
                    return $this->websiteUrl . $imageUrl;
                }
                else
                {
                    return '//' . $_SERVER['SERVER_ADDR'] . $imageUrl;
                }
            }
            else
            {
                return $imageUrl;
            }
        }

        return $this->getPictureGeneratorUrl($image, $imageQuery);
    }
489578
protected static function ensureImageInterfaceInstance($image)
    {
        if ($image instanceof ImageInterface) {
            return $image;
        }

        if (is_resource($image)) {
            return static::getImagine()->read($image);
        }

        if (is_string($image)) {
            return static::getImagine()->open(Yii::getAlias($image));
        }

        throw new InvalidParamException('File should be either ImageInterface, resource or a string containing file path.');
    }
300418
protected function randomColor($image)
    {
        if($this->ismono) {
            return imagecolorallocatealpha($image, $this->monocolor[0], $this->monocolor[1], $this->monocolor[2], $this->rand(0, 96));
        }
        return imagecolorallocate($image, $this->rand(0, 255), $this->rand(0, 255), $this->rand(0, 255));
    }
157019
protected function getReplacementImage(Image $image)
    {
        // Check that the image is in the elements dir, which means it's
        // a default image
        if (!strpos($image->file, '/elements/')) {
            return;
        }

        // Get the current file value form the YAML.  Need to check for the
        // shorthand with the type suffix as well.
        $yaml = app('decoy.elements')->assocConfig();
        $replacement = $yaml[$this->key]['value'];

        // Check if the filenames are the same
        if (pathinfo($image->file, PATHINFO_BASENAME)
            == pathinfo($replacement, PATHINFO_BASENAME)) {
            return;
        }

        // Since the filenames are not the same, remove the old image and generate
        // a new one
        $image->delete();
        $this->exists = true; // It actually does exist if there was an Image
        $this->value = $replacement;

        return $this->defaultImage();
    }
333270
public function run(Image $image)
    {
        $brightness = $this->getBrightness();

        if ($brightness !== null) {
            $image->brightness($brightness);
        }

        return $image;
    }