Closes the image and saves the changes to a file.
$image: An image object returned by image_load(). The object's 'info' property will be updated if the file is saved successfully.
$destination: Destination path where the image should be saved. If it is empty the original image file will be overwritten.
TRUE on success, FALSE on failure.
function image_save(stdClass $image, $destination = NULL) {
if (empty($destination)) {
$destination = $image->source;
}
if ($return = image_toolkit_invoke('save', $image, array(
$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;
}