classes/Tools/Imgix/ImgixTool.php
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;
	}
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;
	}
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 ; }
Builds an Imgix URL for a dynamically sized image.

@param int $id
@param array $size

@return array|bool
Builds an Imgix URL for a dynamically sized image .