You are here

public function GDToolkit::setResource in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php \Drupal\system\Plugin\ImageToolkit\GDToolkit::setResource()
  2. 9 core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php \Drupal\system\Plugin\ImageToolkit\GDToolkit::setResource()

Sets the GD image resource.

Parameters

\GdImage $resource: The GD image resource.

Return value

$this An instance of the current toolkit object.

File

core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php, line 124

Class

GDToolkit
Defines the GD2 toolkit for image manipulation within Drupal.

Namespace

Drupal\system\Plugin\ImageToolkit

Code

public function setResource($resource) {
  if (!$resource instanceof \GdImage) {
    throw new \InvalidArgumentException('Invalid resource argument');
  }
  $this->preLoadInfo = NULL;
  $this->resource = $resource;
  return $this;
}