image_gd_crop

  1. drupal
    1. drupal6 image.gd.inc
    2. drupal7
Versionen
drupal6 image_gd_crop($source, $destination, $x, $y, $width, $height)
drupal7 image_gd_crop(stdClass $image, $x, $y, $width, $height)

Crop an image using the GD toolkit.

see image_crop()

Übergabeparameter

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

$x The starting x offset at which to start the crop, in pixels.

$y The starting y offset at which to start the crop, in pixels.

$width The width of the cropped area, in pixels.

$height The height of the cropped area, in pixels.

Rückgabewert

TRUE or FALSE, based on success.

Verwandte Themen

Code

modules/system/image.gd.inc, line 189

<?php
function image_gd_crop(stdClass $image, $x, $y, $width, $height) {
  $res = image_gd_create_tmp($image, $width, $height);

  if (!imagecopyresampled($res, $image->resource, 0, 0, $x, $y, $width, $height, $width, $height)) {
    return FALSE;
  }

  // Destroy the original image and return the modified image.
  imagedestroy($image->resource);
  $image->resource = $res;
  $image->info['width'] = $width;
  $image->info['height'] = $height;
  return TRUE;
}
?>

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen