function GDToolkit::setResource

Same name in other branches
  1. 9 core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php \Drupal\system\Plugin\ImageToolkit\GDToolkit::setResource()
  2. 10 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

$this 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 137

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;
}

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