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. 8.9.x 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.

Deprecated

in drupal:10.2.0 and is removed from drupal:11.0.0. Use \Drupal\system\Plugin\ImageToolkit\GDToolkit::setImage() instead.

See also

https://www.drupal.org/node/3265963

File

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

Class

GDToolkit
Defines the GD2 toolkit for image manipulation within Drupal.

Namespace

Drupal\system\Plugin\ImageToolkit

Code

public function setResource($resource) {
    @trigger_error(__METHOD__ . '() is deprecated in drupal:10.2.0 and is removed from drupal:11.0.0. Use \\Drupal\\system\\Plugin\\ImageToolkit\\GDToolkit::setImage() instead. See https://www.drupal.org/node/3265963', E_USER_DEPRECATED);
    if (!$resource instanceof \GdImage) {
        throw new \InvalidArgumentException('Invalid resource argument');
    }
    return $this->setImage($resource);
}

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