function ewww_ngg_image_save($filename) { ewwwio_debug_message('<b>' . __FUNCTION__ . '()</b>'); global $ewww_defer; if (file_exists($filename)) { if (ewww_image_optimizer_get_option('ewww_image_optimizer_background_optimization')) { global $ewwwio_image_background; if (!class_exists('WP_Background_Process')) { require_once EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'background.php'; } if (!is_object($ewwwio_image_background)) { $ewwwio_image_background = new EWWWIO_Image_Background_Process(); } $ewwwio_image_background->push_to_queue($filename); $ewwwio_image_background->save()->dispatch(); ewwwio_debug_message("ngg thumb queued: {$filename}"); } else { ewww_image_optimizer($filename); } } ewww_image_optimizer_debug_log(); ewwwio_memory(__FUNCTION__); }
function ewww_ngg_generated_image($image, $size) { // creating the 'registry' object for working with nextgen $registry = C_Component_Registry::get_instance(); // creating a database storage object from the 'registry' object $storage = $registry->get_utility('I_Gallery_Storage'); $filename = $storage->get_image_abspath($image, $size); if (file_exists($filename)) { if (!ewww_image_optimizer_get_option('ewww_image_optimizer_debug')) { ewww_image_optimizer($filename, 2); ewwwio_debug_message("nextgen dynamic thumb saved: {$filename}"); $image_size = ewww_image_optimizer_filesize($filename); ewwwio_debug_message("optimized size: {$image_size}"); } else { global $ewwwio_image_background; if (!class_exists('WP_Background_Process')) { require_once EWWW_IMAGE_OPTIMIZER_PLUGIN_PATH . 'background.php'; } if (!is_object($ewwwio_image_background)) { $ewwwio_image_background = new EWWWIO_Image_Background_Process(); } $ewwwio_image_background->push_to_queue($filename); $ewwwio_image_background->save()->dispatch(); ewwwio_debug_message("nextgen dynamic thumb queued: {$filename}"); } } ewww_image_optimizer_debug_log(); }