function imageapi_optimize_optimize_file in Image Optimize (or ImageAPI Optimize) 7.2
Optimize an image through a specified pipeline.
Parameters
$pipeline: The machine name of the pipeline to optimize the image with.
$drupal_filepath: The path to the image to be optimized.
$image: Optional, the return value from image_load for the $drupal_filepath.
Return value
bool Return TRUE or FALSE indicating success or failure to optimize the image, respectively.
2 calls to imageapi_optimize_optimize_file()
- image_imageapi_optimize_save in ./
imageapi_optimize.module - Implements image_HOOK_save().
- _drush_imageapi_optimize_batch_optimize_single in ./
imageapi_optimize.drush.inc - Batch callback for optimizing a single image.
File
- ./
imageapi_optimize.module, line 783
Code
function imageapi_optimize_optimize_file($pipeline, $drupal_filepath, $image = NULL) {
$return = TRUE;
if ($pipeline = imageapi_optimize_pipeline_load($pipeline)) {
if (is_null($image)) {
$image = image_load($drupal_filepath);
}
foreach ($pipeline['processors'] as $processor) {
$processor_handler = imageapi_optimize_processor_handler($processor);
$return = $return && $processor_handler
->process($image, $drupal_filepath);
}
}
return $return;
}