Image_Processing_Queue::process_image( int $post_id, array $sizes )

Check if the image sizes exist and push them to the queue if not.


Description


Parameters

$post_id

(int) (Required)

$sizes

(array) (Required)


Source

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

		protected function process_image( $post_id, $sizes ) {
			$new_item = false;

			foreach ( $sizes as $size ) {
				if ( self::does_size_already_exist_for_image( $post_id, $size ) ) {
					continue;
				}

				if ( self::is_size_larger_than_original( $post_id, $size ) ) {
					continue;
				}

				$item = array(
					'post_id' => $post_id,
					'width'   => $size[0],
					'height'  => $size[1],
					'crop'    => $size[2],
				);
				$this->process->push_to_queue( $item );
				$new_item = true;
			}

			if ( $new_item ) {
				$this->process->save()->dispatch();
			}
		}

User Contributed Notes

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