function GDToolkit::getResource

Retrieves the GD image resource.

Return value

resource|\GdImage|null The GD image resource, or NULL if not available.

File

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

Class

GDToolkit
Defines the GD2 toolkit for image manipulation within Drupal.

Namespace

Drupal\system\Plugin\ImageToolkit

Code

public function getResource() {
  // @TODO clean-up for PHP 8.0+ https://www.drupal.org/node/3173031
  if (!(is_resource($this->resource) || is_object($this->resource) && $this->resource instanceof \GdImage)) {
    $this->load();
  }
  return $this->resource;
}

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