function ImageInterface::crop

Same name in other branches
  1. 9 core/lib/Drupal/Core/Image/ImageInterface.php \Drupal\Core\Image\ImageInterface::crop()
  2. 8.9.x core/lib/Drupal/Core/Image/ImageInterface.php \Drupal\Core\Image\ImageInterface::crop()
  3. 11.x core/lib/Drupal/Core/Image/ImageInterface.php \Drupal\Core\Image\ImageInterface::crop()

Crops an image to a rectangle specified by the given dimensions.

Parameters

int $x: The top left coordinate, in pixels, of the crop area (x axis value).

int $y: The top left coordinate, in pixels, of the crop area (y axis value).

int $width: The target width, in pixels.

int $height: The target height, in pixels.

Return value

bool TRUE on success, FALSE on failure.

1 method overrides ImageInterface::crop()
Image::crop in core/lib/Drupal/Core/Image/Image.php
Crops an image to a rectangle specified by the given dimensions.

File

core/lib/Drupal/Core/Image/ImageInterface.php, line 201

Class

ImageInterface
Provides an interface for image objects.

Namespace

Drupal\Core\Image

Code

public function crop($x, $y, $width, $height = NULL);

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.