Returns destination image function

@param string|null $imgExtension
@return null|string
6226
private static function getDestinationFunction(string $imgExtension = null): ?string
    {
        switch ($imgExtension) {
            case 'jpg':
            case 'jpeg':
                $dst['function'] = 'imagejpeg';
                break;
            case 'png':
                $dst['function'] = 'imagepng';
                break;
            case 'gif':
                $dst['function'] = 'imagegif';
                break;
            default:
                $dst['function'] = null;
                break;
        }
        return $dst['function'];
    }
414943
public function getThumb()
    {
        $image = $this->node
            ->filter('.item_imagePic .lazyload[data-imgsrc]')
            ->first();

        if (0 === $image->count()) {
            return null;
        }

        $src = $image
            ->attr('data-imgsrc');

        return (string)Http::createFromString($src)->withScheme('https');
    }
678922
public function getImageSize($aImgSizes, $sIndex = null)
    {
        $aSize = [];
        if (isset($sIndex) && is_array($aImgSizes) && isset($aImgSizes[$sIndex])) {
            $aSize = explode('*', $aImgSizes[$sIndex]);
        } elseif (is_string($aImgSizes)) {
            $aSize = explode('*', $aImgSizes);
        }
        if (is_array($aSize) && 2 == count($aSize)) {
            $x = (int) $aSize[0];
            $y = (int) $aSize[1];
            if ($x && $y) {
                return $aSize;
            }
        }

        return null;
    }
1164909
public function image($destination, $min_resolution, $max_resolution) {
    $extension = pathinfo($destination, PATHINFO_EXTENSION);
    $min = explode('x', $min_resolution);
    $max = explode('x', $max_resolution);

    $width = rand((int) $min[0], (int) $max[0]);
    $height = rand((int) $min[1], (int) $max[1]);

    // Make an image split into 4 sections with random colors.
    $im = imagecreate($width, $height);
    for ($n = 0; $n < 4; $n++) {
      $color = imagecolorallocate($im, rand(0, 255), rand(0, 255), rand(0, 255));
      $x = $width / 2 * ($n % 2);
      $y = $height / 2 * (int) ($n >= 2);
      imagefilledrectangle($im, $x, $y, $x + $width / 2, $y + $height / 2, $color);
    }

    // Make a perfect circle in the image middle.
    $color = imagecolorallocate($im, rand(0, 255), rand(0, 255), rand(0, 255));
    $smaller_dimension = min($width, $height);
    imageellipse($im, $width / 2, $height / 2, $smaller_dimension, $smaller_dimension, $color);

    $save_function = 'image' . ($extension == 'jpg' ? 'jpeg' : $extension);
    $save_function($im, $destination);
    return $destination;
  }
1176045
final public function imageAsString($as = null)
	{
		$image = $this->imageAsDOMElement($as);
		return $image->ownerDocument->saveHTML($image);
	}
1256600
public function offsetGet($offset): Image
    {
        return $this->offsetExists($offset) ? $this->extract_band($offset) : null;
    }
551832
private static function detectQualityOfJpgUsingImagickExtension($filename)
    {
        if (extension_loaded('imagick') && class_exists('\\Imagick')) {
            try {
                $img = new \Imagick($filename);

                // The required function is available as from PECL imagick v2.2.2
                if (method_exists($img, 'getImageCompressionQuality')) {
                    return $img->getImageCompressionQuality();
                }
            } catch (\Exception $e) {
                // Well well, it just didn't work out.
                // - But perhaps next method will work...
            }
        }
        return null;
    }
940738
public function getPictureUrl($iIndex = 1)
    {
        if ($iIndex) {
            $sImgName = false;
            if (!$this->_isFieldEmpty("oxarticles__oxpic" . $iIndex)) {
                $sImgName = basename($this->{"oxarticles__oxpic$iIndex"}->value);
            }

            $sSize = \OxidEsales\Eshop\Core\Registry::getConfig()->getConfigParam('aDetailImageSizes');

            return \OxidEsales\Eshop\Core\Registry::getPictureHandler()
                ->getProductPicUrl("product/{$iIndex}/", $sImgName, $sSize, 'oxpic' . $iIndex);
        }
    }
878870
private function getImageRetrivingClosure()
    {
        /*
         * Closure to retrieve an instnce of uploaded image with given filename
         * from request.
         *
         * @param string $filename
         * @return \Vinterskogen\UploadedImage\UploadedImage|null
         */
        return function ($filename) {
            if (! Request::hasFile($filename)) {
                return;
            }

            $uploadedFile = Request::file($filename);

            return UploadedImage::createFromBase($uploadedFile);
        };
    }
664568
public function getImageData($pathToImage)
    {
        /*
         * Reinitialize imagick because the target resolution must be set
         * before reading the actual image.
         */
        $this->imagick = new Imagick();

        $this->imagick->setResolution($this->resolution, $this->resolution);

        if ($this->colorspace !== null) {
            $this->imagick->setColorspace($this->colorspace);
        }

        if ($this->compressionQuality !== null) {
            $this->imagick->setCompressionQuality($this->compressionQuality);
        }

        if (filter_var($this->pdfFile, FILTER_VALIDATE_URL)) {
            return $this->getRemoteImageData($pathToImage);
        }

        $this->imagick->readImage(sprintf('%s[%s]', $this->pdfFile, $this->page - 1));

        if (is_int($this->layerMethod)) {
            $this->imagick = $this->imagick->mergeImageLayers($this->layerMethod);
        }

        $this->imagick->setFormat($this->determineOutputFormat($pathToImage));

        return $this->imagick;
    }
451695
function getTransformation(&$force_suffix = null){
		$force_suffix = $this->_suffix;
		if($this->_format){
			$force_suffix = $this->_format;
		}
		if(!$this->_transformation_string){
			return $this->getWidth()."x".$this->getHeight();
		}
		if(preg_match('/xt$/',$this->_transformation_string)){
			// Transparent -> suffix needs to be png
			$force_suffix = "png";
		}
		return $this->_transformation_string;
	}
605764
@Deprecated
    private BufferedImage getImage(String suffix) throws IOException {
        StringBuffer buffer = getBaseImageUrl();
        buffer.append(suffix);
        return _getImage(buffer.toString());
    }
578440
private function normalizeFileExtension($extension = null)
    {
        $extension = strtolower($extension ? $extension : $this->extension);

        if ($extension == 'jpeg') {
                $extension = 'jpg';
        }

        return $extension;
    }
14218
private function getQualityFromExtension($ext, $transform = null): string
    {
        /** @var ConfigModel $settings */
        $config = ImagerService::getConfig();

        switch ($ext) {
            case 'png':
                $pngCompression = $config->getSetting('pngCompressionLevel', $transform);

                return max(100 - ($pngCompression * 10), 1);

            case 'webp':
                return $config->getSetting('webpQuality', $transform);
        }

        return $config->getSetting('jpegQuality', $transform);
    }
21380
function(imgPath, callback) {
        this.getImageChecksum(imgPath, function(err, checksum) {
            if (err) {
                return callback(err);
            }

            this.imageWithChecksumExists(checksum, callback);
        }.bind(this));

        return this;
    }
1143672
function Image($file, $x = null, $y = null, $w=0, $h=0, $type='', $link='',  $isMask=false,  $maskImg=0)
{
    //Put an image on the page
    if(!isset($this->images[$file]))
    {
        //First use of image,  get info
        if($type=='')
        {
            $pos=strrpos($file, '.');
            if(!$pos)
                $this->Error('Image file has no extension and no type was specified: '.$file);
            $type=substr($file, $pos+1);
        }
        $type=strtolower($type);
        $mqr=get_magic_quotes_runtime();
        //set_magic_quotes_runtime(0);
        if($type=='jpg' || $type=='jpeg')
            $info=$this->_parsejpg($file);
        elseif($type=='png'){
            $info=$this->_parsepng($file);
            if ($info=='alpha') return $this->ImagePngWithAlpha($file, $x, $y, $w, $h, $link);
        }
        else
        {
            //Allow for additional formats
            $mtd='_parse'.$type;
            if(!method_exists($this, $mtd))
                $this->Error('Unsupported image type: '.$type);
            $info=$this->$mtd($file);
        }
        //set_magic_quotes_runtime($mqr);
        
        if ($isMask){
      $info['cs']="DeviceGray"; // try to force grayscale (instead of indexed)
    }
        $info['i']=count($this->images)+1;
        if ($maskImg>0) $info['masked'] = $maskImg;###
        $this->images[$file]=$info;
    }
    else
        $info=$this->images[$file];
    //Automatic width and height calculation if needed
    if($w==0 && $h==0)
    {
        //Put image at 72 dpi
        $w=$info['w']/$this->k;
        $h=$info['h']/$this->k;
    }
    if($w==0)
        $w=$h*$info['w']/$info['h'];
    if($h==0)
        $h=$w*$info['h']/$info['w'];
    
    // embed hidden,  ouside the canvas
    if ((float)FPDF_VERSION>=1.7){
        if ($isMask) $x = ($this->CurOrientation=='P'?$this->CurPageSize[0]:$this->CurPageSize[1]) + 10;
    }else{
        if ($isMask) $x = ($this->CurOrientation=='P'?$this->CurPageFormat[0]:$this->CurPageFormat[1]) + 10;
    }
        
    $this->_out(sprintf('q %.2f 0 0 %.2f %.2f %.2f cm /I%d Do Q', $w*$this->k, $h*$this->k, $x*$this->k, ($this->h-($y+$h))*$this->k, $info['i']));
    if($link)
        $this->Link($x, $y, $w, $h, $link);
        
    return $info['i'];
}
1193922
public function getFileContentsInlineMap($includeLastExtension = true)
    {
        $ret = $this->_fileContents;
        if ($this->_mimeType == 'text/css') {
            $ret .= "\n/*# sourceMappingURL=data:application/json;base64,".base64_encode($this->getMapContents($includeLastExtension))." */\n";
        } else {
            $ret .= "\n//# sourceMappingURL=data:application/json;base64,".base64_encode($this->getMapContents($includeLastExtension))."\n";
        }
        return $ret;
    }