You are here

public function GDToolkit::setResource in Zircon Profile 8

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

Sets the GD image resource.

Parameters

resource $resource: The GD image resource.

Return value

\Drupal\system\Plugin\ImageToolkit\GDToolkit An instance of the current toolkit object.

1 call to GDToolkit::setResource()
GDToolkit::load in core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php
Loads a GD resource from a file.

File

core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php, line 125
Contains \Drupal\system\Plugin\ImageToolkit\GDToolkit.

Class

GDToolkit
Defines the GD2 toolkit for image manipulation within Drupal.

Namespace

Drupal\system\Plugin\ImageToolkit

Code

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