Returns the absolute URL of the image to the desired variant.
@param Picture $picture
@return string
765893
public function getUrl(Picture $picture)
    {
        return $this->storageUrl . str_replace($this->basePath, '', $this->getFileName($picture));
    }
826561
public function storageUrl($image, ?string $alt = null, array $extra = []): ?string
    {
        return $this->generateImagePayload($image, $alt, $extra, true, true)->url ?? null;
    }
996305
public function imagePath($image)
    {
        if (!$image) {
            return '';
        }

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

        // deliver original file
        $src = $this->router->generate('frontendmedia_inline', ['fileId' => $fileId], UrlGeneratorInterface::ABSOLUTE_PATH);

        return $src;
    }
616192
public function apply(Picture $picture)
    {
        $resource = $picture->getResource();

        if($picture->isGd())
        {
            imagefilter($resource, IMG_FILTER_GRAYSCALE);
            imagefilter($resource, IMG_FILTER_COLORIZE, 100, 60, 0);

            $picture->setResource($resource);
        }
        else
        {
            $resource->sepiaToneImage(80);
        }
    }
981250
protected function applyWatermarkGD($resource, Picture $picture) {

        // SOURCE IMAGE DIMENSIONS
        $pictureWidth  = imagesx($resource);
        $pictureHeight = imagesy($resource);

        // WATERMARK DIMENSIONS
        $watermarkPicture = new Picture($this->watermark, NULL, Picture::WORKER_GD);

        $opacity = new Opacity($this->opacity);
        $opacity->apply($watermarkPicture);

        if($this->size)
        {
            $resize = new Resize(
                $pictureWidth / 100 * $this->size,
                $pictureHeight / 100 * $this->size,
                Resize::MODE_FIT
            );

            $resize->apply($watermarkPicture);
        }

        $watermark = $watermarkPicture->getResource($watermarkPicture::WORKER_GD);

        imagealphablending($watermark, TRUE);

        $watermarkWidth  = imagesx($watermark);
        $watermarkHeight = imagesx($watermark);

        // CALCULATE WATERMARK POSITION
        switch($this->position)
        {
            case 'repeat':

                for($w = 0; $w < $pictureWidth; $w += $watermarkWidth + $this->space)
                {
                    for($h = 0; $h < $pictureHeight; $h += $watermarkHeight + $this->space)
                    {
                        imagecopy($resource, $watermark, $w, $h, 0, 0, $watermarkWidth, $watermarkHeight);
                    }
                }

                return $resource;

            case 'center':

                $positionX = ($pictureWidth - $watermarkWidth) / 2 - $this->offsetX;
                $positionY = ($pictureHeight - $watermarkHeight) / 2 - $this->offsetY;
                break;

            case 'topRight':

                $positionX = $pictureWidth - $watermarkWidth - $this->offsetX;
                $positionY = $this->offsetY;
                break;

            case 'bottomRight':

                $positionX = $pictureWidth  - $watermarkWidth  - $this->offsetX;
                $positionY = $pictureHeight - $watermarkHeight - $this->offsetY;
                break;

            case 'bottomLeft':

                $positionX = $this->offsetX;
                $positionY = $pictureHeight - $watermarkHeight - $this->offsetY;
                break;

            default:

                $positionX = $this->offsetX;
                $positionY = $this->offsetY;
                break;
        }

        imagecopy($resource, $watermark, $positionX, $positionY, 0, 0, $watermarkWidth, $watermarkHeight);

        return $resource;
    }
53856
protected function prepareImage($picture, $alt = '') {
    $value = NULL;
    $files = $this->loadByUuid('file', $picture);

    if ($files instanceof File) {
      $value = [
        [
          'target_id' => $files->id(),
          'alt' => $alt ?: 'file' . $files->id(),
        ],
      ];
    }

    return $value;
  }
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);
    }
1119811
private function getText($image)
    {
        $rtn = '';
        $w = imagesx($image);
        $h = imagesy($image);
        for ($y = 0; $y < $h; ++$y) {
            for ($x = 0; $x < $w; ++$x) {
                $rgb = imagecolorat($image, $x, $y);
                $rtn .= $this->getDotFromRgb($rgb);
            }
        }

        return $rtn;
    }
843417
public function imageExtension($image)
    {
        $filename = $image;
        $extension = explode('.', $filename);
        $ext = strtolower(end($extension));

        return $ext;
    }
79416
public function getInfo($image)
    {
        if (DriverInterface::IMAGE_STORAGE_STRING == $this->getImageStorage($image)) {
            $image = 'data://application/octet-stream;base64,'  . base64_encode($image);
        }
        return getimagesize($image);
    }
1374548
public function apply(Picture $picture)
    {
        // GD VERSION IS BETTER AND IS PREFERRED
        if($picture->isGd() || $picture->gdAvailable())
        {
            $resource = $picture->getResource($picture::WORKER_GD);

            imagefilter($resource, IMG_FILTER_EDGEDETECT);

            $picture->setResource($resource);
        }
        else
        {
            $resource = $picture->getResource($picture::WORKER_IMAGICK);
            $resource->convolveImage(array(

                -1,-1,-1,-1,8,-1,-1,-1,-1
            ));
            $resource->thresholdImage(1);
        }
    }
980837
public static function getUrl($resource, $absolute = false) {
		if (strpos ( $resource, '//' ) !== false) {
			return $resource;
		}
		if ($absolute) {
			return self::$siteURL . self::ASSETS_FOLDER . $resource;
		}
		return ltrim ( self::ASSETS_FOLDER, '/' ) . $resource;
	}
1304376
public function apply(Picture $picture)
    {
        $resource = $picture->getResource();

        if($picture->isGd())
        {
            imagesavealpha($resource, TRUE);
            imagealphablending($resource, FALSE);

            $w = imagesx($resource);
            $h = imagesy($resource);

            // FIND SMALLEST ALPHA VALUE
            $minimalAlpha = 127;

            for($x = 0; $x < $w; $x++) {

                for($y = 0; $y < $h; $y++)
                {
                    $alpha = (imagecolorat($resource, $x, $y) >> 24 ) & 0xFF;

                    if($alpha < $minimalAlpha)
                    {
                        $minimalAlpha = $alpha;
                    }
                }
            }

            // MODIFY IMAGE PIXELS
            for($x = 0; $x < $w; $x++)
            {
                for($y = 0; $y < $h; $y++)
                {
                    $colorXY = imagecolorat($resource, $x, $y);
                    $alpha = ($colorXY >> 24) & 0xFF;

                    if($minimalAlpha !== 127)
                    {
                        $alpha = 127 + 127 * $this->opacity * ($alpha - 127) / (127 - $minimalAlpha);
                    }
                    else
                    {
                        $alpha += 127 * $this->opacity;
                    }

                    $alphaColorXY = imagecolorallocatealpha(

                        $resource,
                        ($colorXY >> 16) & 0xFF,
                        ($colorXY >> 8) & 0xFF,
                        $colorXY & 0xFF,
                        $alpha
                    );

                    // MODIFY SINGLE PIXEL VALUE
                    imagesetpixel($resource, $x, $y, $alphaColorXY);
                }
            }

            $picture->setResource($resource);
        }
        else
        {
            if(!$resource->getImageAlphaChannel())
            {
                $resource->setImageAlphaChannel(Imagick::ALPHACHANNEL_ACTIVATE);
            }

            $resource->evaluateImage(Imagick::EVALUATE_MULTIPLY, $this->opacity, Imagick::CHANNEL_ALPHA);
        }
    }
998282
public function getImagesUrl() {
        $url = sprintf($this->getBaseUrl() . '/users/%s/images.json', $this->getUser());

        return Http\ImagesUrl::factory(
            $url,
            $this->getConfig('privateKey'),
            $this->getPublicKey()
        );
    }
1278740
def _get_thumbnail_url(image):
    
    lhs, rhs = splitext(image.url)
    lhs += THUMB_EXT
    thumb_url = f'{lhs}{rhs}'
    return thumb_url
1300706
public function getFileName(Picture $picture)
    {
        $sourceImage = $picture->getImage();

        $fileName = pathinfo($sourceImage, PATHINFO_FILENAME) . '.' .
            sprintf('%u', crc32($picture->getImageQuery())) . '.';

        if($created = filemtime($sourceImage))
        {
            $fileName .= $created . '.';
        }

        return $fileName . pathinfo($sourceImage, PATHINFO_EXTENSION);
    }
1135004
public function getImageWidth($image): ?string
    {
        if (null === ($file = $this->container->get('huh.utils.file')->getFileFromUuid($image))) {
            return null;
        }

        return $file->width;
    }