classes/Tools/Storage/StorageTool.php
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;
    }
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;
    }
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 ; }
Performs the image downsize regardless if Imgix is enabled or not.
@param $fail
@param $id
@param $size
@return array
@throws StorageException
Performs the image downsize regardless if Imgix is enabled or not .