Performs the image downsize regardless if Imgix is enabled or not.
@param $fail
@param $id
@param $size
@return array
@throws StorageException
772343
public function forcedImageDownsize($fail, $id, $size) {
        if(empty($size) || empty($id) || is_array($size)) {
            return $fail;
        }

        $meta = wp_get_attachment_metadata($id);

        if(empty($meta)) {
            return $fail;
        }

        if(!isset($meta['sizes'])) {
            return $fail;
        }

        if(!isset($meta['sizes'][$size])) {
            return $fail;
        }

        $isOffloadS3 = (arrayPath($meta, 's3/provider', null) == 'aws');

        $sizeMeta = $meta['sizes'][$size];
        if(!isset($sizeMeta['s3'])) {
            if ($isOffloadS3) {
                if ($this->fixOffloadS3Meta($id, $meta)) {
                    return $this->forcedImageDownsize($fail, $id, $size);
                } else {
                    return $fail;
                }
            } else {
                return $fail;
            }
        }

        $url = $this->getAttachmentURLFromMeta($sizeMeta);// $sizeMeta['s3']['url'];

        $result = [
            $url,
            $sizeMeta['width'],
            $sizeMeta['height'],
            true
        ];

        return $result;
    }
796700
protected function resize(Imagick $image, $width, $height)
    {
        $image->resizeImage($width, $height, Imagick::FILTER_LANCZOS, 1);

        return $image;
    }
1136548
protected function resizeExact(ImageInterface $image, $width, $height, $enlarge = true)
    {
        return $image->resize(new Box($width, $height));
    }
1268303
public function autoOutput($ID, $Destination = "output.png")
    {
        if (php_sapi_name() == "cli") {
            $this->saveFromCache($ID, $Destination);
        } else {
            $this->strokeFromCache($ID);
        }
    }
239999
public function _failed(TestInterface $test, $fail)
    {
        if (isset($this->container) && $this->container->has(ErrorHandlerInterface::class)) {
            $error = $this->container->get(ErrorHandlerInterface::class)->getError();
            
            if ($error) {
                $this->debug((string)$error);
            }
        }

        
        parent::_failed($test, $fail);
    }
423666
public function setBodyPartSize($id, $size)
    {
        $this->_data[Horde_Imap_Client::FETCH_BODYPARTSIZE][$id] = intval($size);
    }
387290
public function saveFromCache($ID, $Destination)
    {
        /* Get the raw picture from the cache */
        $Picture = $this->getFromCache($ID);

        /* Do we have a hit? */
        if ($Picture == null) {
            return false;
        }

        /* Flush the picture to a file */
        $Handle = fopen($Destination, "w");
        fwrite($Handle, $Picture);
        fclose($Handle);

        /* All went fine */
        return true;
    }
89343
public function thumbnail($size = null)
    {
        $size = ($size) ? $size : $this->config->get('images.size');

        if ($id = $this->thumbnailId) {
            return new Image($id, $size);
        }
    }
749571
public function findByID($id, $fail = true)
    {
        if ($fail) {
            return $this->newQuery()->findOrFail($id);
        }

        return $this->newQuery()->find($id);
    }
1234776
public function buildGifJpeg($value, $postId, $size) {
		return $this->buildImgixImage($postId, $size, null, false, ['fmt' => 'pjpg']);
	}
543644
public function addImageSize(ImageSize $size)
	{
		if ($this->imageSizes->containsKey($size->getName())) {
			return false;
		} else {
			$this->imageSizes->set($size->getName(), $size);
			return true;
		}
	}
1370022
private function buildSizedImgixImage($id, $size) {
		$meta = wp_get_attachment_metadata($id);
		if(!$meta || empty($meta)) {
			return false;
		}

		if(!isset($meta['s3'])) {
			return [];
		}

		$imgix = new UrlBuilder($this->imgixDomains, $this->useHTTPS);

		if($this->signingKey) {
			$imgix->setSignKey($this->signingKey);
		}


		$is_crop = ((count($size) >= 3) && ($size[2] == 'crop'));
		if (!$is_crop && $this->shouldCrop) {
		    $this->shouldCrop = false;
		    $is_crop = true;
        }

        if ($is_crop && (($size[0] === 0) || ($size[1] === 0))) {
		    if ($size[0] === 0) {
		        $size[0] = 10000;
            } else {
		        $size[1] = 10000;
            }

		    $is_crop = false;
        }

		if(isset($size['width'])) {
			$size = [
				$size['width'],
				$size['height']
			];
		}

		$params = [
			'fit' => ($is_crop) ? 'crop' : 'fit',
			'w' => $size[0],
			'h' => $size[1],
			'fm' => 'jpg'
		];
		$params = apply_filters('ilab-imgix-filter-parameters', $params, $size, $id, $meta);

		$imageFile = (isset($meta['s3'])) ? $meta['s3']['key'] : $meta['file'];

		$result = [
			$imgix->createURL(str_replace('%2F', '/', urlencode($imageFile)), $params),
			$size[0],
			$size[1]
		];

		return $result;
	}
363847
public function handleDeleteImage(int $id): void
	{
		if ($this->request->isAjax()) {
			$result = $this->getStorage()->delete($id);
			$this->imageStorage->delete($result);

			$this->redrawControl('gallery');
		} else {
			throw new AbortException;
		}
	}
1073663
public function imageGetIntermediateSize($data, $post_id, $size) {
	    $result = $this->buildImgixImage($post_id, $size);

	    if (is_array($result) && !empty($result)) {
            $data['url'] = $result[0];
        }

		return $data;
	}
191026
public function remove($id) {
		try {
			return $this->getBackend()->delete($this->prepareId($id));
		}
		catch (PhalconCacheException $exception) {
			if ($this->operationsExceptions) {
				throw new OperationFailed('Removing of the data from the cache failed due to the backend exception occurred: "' . $exception->getMessage() . '"', 0, $exception);
			} else {
				return false;
			}
		}
	}
513138
public function doResize($destination, $size, $cropX=0, $cropY=0, $resized=false)
    {
        if (($resource = $this->getResource()) == null) {
            return false;
        }

        $image     = imagecreatetruecolor($size['width'], $size['height']);
        $imageCopy = false;

        if ($resized) {
            $imageCopy = imagecopyresized($image, $resource, 0, 0, $cropX, $cropY, $size['width'], $size['height'], $size['width'], $size['height']);
        }
        else {
            $imageCopy = imagecopyresampled($image, $resource, 0, 0, $cropX, $cropY, $size['width'], $size['height'], $this->sourceWidth, $this->sourceHeight);
        }


        if ($imageCopy) {
            if ($this->save($image, $destination)) {
                imagedestroy($image);

                return true;
            }
            else {
                imagedestroy($image);

                return false;
            }
        }
        else {
            imagedestroy($image);

            return false;
        }
    }
1347833
public static function resize(\Imagick $source, int $boxWidth, int $boxHeight, array $options = []) : \Imagick
    {
        $results = self::resizeMulti($source, [['width' => $boxWidth, 'height' => $boxHeight]], $options);
        return $results[0];
    }