You are here

function imageapi_gd_image_open in ImageAPI 6

Same name and namespace in other branches
  1. 5 imageapi_gd.module \imageapi_gd_image_open()

Open an image file.

Parameters

$image: An image object. The $image->resource value will populated by this call.

Return value

TRUE or FALSE, based on success.

File

./imageapi_gd.module, line 41
GD2 toolkit functions

Code

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