Image_Processing_Queue::is_size_larger_than_original( int $post_id, array $size )

Check if an image size is larger than the original.


Description


Parameters

$post_id

(int) (Required) Image ID.

$size

(array) (Required) array in format array(width,height,crop).


Return

(bool)


Source

File: classes/library/image-processing-queue/includes/class-image-processing-queue.php

		public static function is_size_larger_than_original( $post_id, $size ) {
			$image_meta = self::get_image_meta( $post_id );

			if ( ! isset( $image_meta['width'] ) || ! isset( $image_meta['height'] ) ) {
				return true;
			}

			if ( $size[0] > $image_meta['width'] || $size[1] > $image_meta['height'] ) {
				return true;
			}

			return false;
		}

User Contributed Notes

You must log in before being able to contribute a note or feedback.