function image_gd_load

7.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

image_load()

Related topics

File

drupal-7.x/modules/system/image.gd.inc, line 234
GD2 toolkit for image manipulation within Drupal.

Code

function image_gd_load(stdClass $image) {
  $extension = str_replace('jpg', 'jpeg', $image->info['extension']);
  $function = 'imagecreatefrom' . $extension;
  return (function_exists($function) && $image->resource = $function($image->source));
}