Closes the image and saves the changes to a file.
object $image: An image object returned by image_load(). The object's 'info' property will be updated if the file is saved successfully.
$destination: (optional) Destination path where the image should be saved. If it is empty the original image file will be overwritten.
bool TRUE on success, FALSE on failure.
\Drupal\system\Plugin\ImageToolkitInterface::save()
function image_save($image, $destination = NULL) {
if (empty($destination)) {
$destination = $image->source;
}
if ($return = $image->toolkit
->save($image, $destination)) {
// Clear the cached file size and refresh the image information.
clearstatcache(TRUE, $destination);
$image->info = image_get_info($destination, $image->toolkit);
if (drupal_chmod($destination)) {
return $return;
}
}
return FALSE;
}