You are here

function iek_gd_overlay in Image effect kit 7

Add a overlay on an image by using the GD toolkit.

Parameters

object $image: An image object. The $image->resource, $image->info['width'], and $image->info['height'] values will be modified by this call.

array $data: An array that contains all the effect parameters. $data['overlay_name']: the id name of overlay image. $data['bg_offset']: the font of watermark. $data['overlay_offset']: the font color of watermark.

Return value

bool TRUE or FALSE, based on success.

File

./iek.gd.inc, line 565
GD2 toolkit for image manipulation within Drupal.

Code

function iek_gd_overlay(stdClass $image, $data) {
  $iek_overlay = iek_get_overlays($data['overlay_name']);
  $overlay_path = drupal_realpath($iek_overlay['path'] . '/' . $iek_overlay['file']);
  $overlay_info = image_get_info($overlay_path);
  $overlay_tmp = iek_gd_create_image($overlay_path);
  imagecopyresampled($image->resource, $overlay_tmp, $data['bg_offset'], $data['bg_offset'], $data['overlay_offset'], $data['overlay_offset'], $image->info['width'] - $data['bg_offset'] * 2, $image->info['height'] - $data['bg_offset'] * 2, $overlay_info['width'] - $data['overlay_offset'] * 2, $overlay_info['height'] - $data['overlay_offset'] * 2);
  return TRUE;
}