function imageapi_gd_image_close in ImageAPI 5
Same name and namespace in other branches
- 6 imageapi_gd.module \imageapi_gd_image_close()
Save an image file to a destination.
Parameters
$image: An image object.
$destination: A string file path where the image should be saved.
$extension: A string containing one of the following extensions: gif, jpg, jpeg, png.
Return value
TRUE or FALSE, based on success.
File
- ./
imageapi_gd.module, line 59 - GD2 toolkit functions
Code
function imageapi_gd_image_close($image, $destination) {
$extension = str_replace('jpg', 'jpeg', $image->info['extension']);
$function = 'image' . $extension;
if (!function_exists($function)) {
return FALSE;
}
if ($extension == 'jpeg') {
return $function($image->resource, $destination, variable_get('imageapi_jpeg_quality', 75));
}
else {
// Always save PNG images with full transparency.
if ($extension == 'png') {
imagealphablending($image->resource, FALSE);
imagesavealpha($image->resource, TRUE);
}
return $function($image->resource, $destination);
}
}