You are here

function iek_gd_create_image in Image effect kit 8

Same name and namespace in other branches
  1. 7 iek.module \iek_gd_create_image()

Creates an image from file or URL.

Parameters

string $file: Path to the image.

Return value

resource|NULL An image identifier representing the image obtained from the given filename.

1 call to iek_gd_create_image()
ImageOverlay::execute in src/Plugin/ImageToolkit/Operation/gd/ImageOverlay.php
Performs the actual manipulation on the image.

File

./iek.module, line 304
Contains "iek" module.

Code

function iek_gd_create_image($file) {
  $data = @getimagesize($file);
  switch ($data['mime']) {
    case 'image/jpeg':
      $image = imagecreatefromjpeg($file);
      break;
    case 'image/gif':
      $image = imagecreatefromgif($file);
      break;
    case 'image/png':
      $image = imagecreatefrompng($file);
      break;
    default:
      $image = NULL;
      break;
  }
  return $image;
}