1.20.x image.gd.inc | image_gd_load(stdClass $image) |
GD helper function to create an image resource from a file.
Parameters
$image: An image object. The $image->resource value will populated by this call.
Return value
TRUE or FALSE, based on success.:
See also
Related topics
File
- modules/
system/ image.gd.inc, line 229 - GD2 toolkit for image manipulation within Backdrop.
Code
function image_gd_load(stdClass $image) {
$extension = str_replace('jpg', 'jpeg', $image->info['extension']);
$function = 'imagecreatefrom' . $extension;
if (function_exists($function)) {
$image->resource = $function($image->source);
}
return !empty($image->resource);
}