You are here

public function GDToolkit::getResource in Drupal 9

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

Retrieves the GD image resource.

Return value

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

5 calls to GDToolkit::getResource()
GDToolkit::getHeight in core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php
Returns the height of the image.
GDToolkit::getTransparentColor in core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php
Gets the color set for transparency in GIF images.
GDToolkit::getWidth in core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php
Returns the width of the image.
GDToolkit::load in core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php
Loads a GD resource from a file.
GDToolkit::save in core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php
Writes an image resource to a destination file.

File

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

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