if ( !
$this->image->
valid() ) { return new WP_Error( 'invalid_image',
__( 'File is not an image.'
),
$this->file
);
} // Select the first frame to handle animated images properly.
if ( is_callable( array
( $this->image, 'setIteratorIndex'
) ) ) { $this->image->
setIteratorIndex( 0
);
} $this->mime_type =
$this->
get_mime_type( $this->image->
getImageFormat() );
} catch ( Exception
$e ) { return new WP_Error( 'invalid_image',
$e->
getMessage(),
$this->file
);
} $updated_size =
$this->
update_size();
if ( is_wp_error( $updated_size ) ) { return $updated_size;
} return $this->
set_quality();
}