get_ngg_image( $id ); if ( ! is_object( $image ) ) { ++$item['attempts']; sleep( 4 ); ewwwio_debug_message( "could not retrieve image, requeueing {$item['attempts']}" ); return $item; } $ewwwngg->ewww_added_new_image( $image ); return false; } /** * Runs failure routine for an item from the queue. * * @access protected * * @param array $item The id of the attachment, how many attempts have been made to process * the item and whether it is a new upload. */ protected function failure( $item ) { if ( empty( $item['id'] ) ) { return; } if ( ! defined( 'NGG_PLUGIN_VERSION' ) ) { return false; } // Get a NextGEN image object. global $ewwwngg; $image = $ewwwngg->get_ngg_image( $item['id'] ); $file_path = $ewwwngg->get_image_abspath( $image, 'full' ); if ( ! empty( $file_path ) ) { ewww_image_optimizer_add_file_exclusion( $file_path ); } } }