function image_gd_open

6.x image.gd.inc image_gd_open($file, $extension)

GD helper function to create an image resource from a file.

Parameters

$file: A string file path where the iamge should be saved.

$extension: A string containing one of the following extensions: gif, jpg, jpeg, png.

Return value

An image resource, or FALSE on error.

Related topics

3 calls to image_gd_open()
image_gd_crop in drupal-6.x/includes/image.gd.inc
Crop an image using the GD toolkit.
image_gd_resize in drupal-6.x/includes/image.gd.inc
Scale an image to the specified size using GD.
image_gd_rotate in drupal-6.x/includes/image.gd.inc
Rotate an image the given number of degrees.

File

drupal-6.x/includes/image.gd.inc, line 183
GD2 toolkit for image manipulation within Drupal.

Code

function image_gd_open($file, $extension) {
  $extension = str_replace('jpg', 'jpeg', $extension);
  $open_func = 'imageCreateFrom' . $extension;
  if (!function_exists($open_func)) {
    return FALSE;
  }
  return $open_func($file);
}