function imageapi_image_close in ImageAPI 5
Same name and namespace in other branches
- 6 imageapi.module \imageapi_image_close()
Close the image and save the changes to a file.
Parameters
$image: An image object returned by imageapi_image_open(). 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.
Return value
TRUE or FALSE, based on success.
File
- ./
imageapi.module, line 393 - An ImageAPI supporting mulitple image toolkits. Image toolkits are implemented as modules. Images are objects, but have no methods
Code
function imageapi_image_close($image, $destination = NULL) {
if (empty($destination)) {
$destination = $image->source;
}
if ($return = imageapi_toolkit_invoke('close', $image, array(
$destination,
))) {
// Clear the cached file size and refresh the image information.
clearstatcache();
$image->info = image_get_info($destination);
if (@chmod($destination, 0664)) {
return $return;
}
watchdog('imageapi', t('Could not set permissions on destination file: %file', array(
'%file' => $destination,
)));
}
return FALSE;
}