function GDToolkit::getWidth

Same name in other branches
  1. 9 core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php \Drupal\system\Plugin\ImageToolkit\GDToolkit::getWidth()
  2. 8.9.x core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php \Drupal\system\Plugin\ImageToolkit\GDToolkit::getWidth()
  3. 10 core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php \Drupal\system\Plugin\ImageToolkit\GDToolkit::getWidth()

Overrides ImageToolkitInterface::getWidth

File

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

Class

GDToolkit
Defines the GD2 toolkit for image manipulation within Drupal.

Namespace

Drupal\system\Plugin\ImageToolkit

Code

public function getWidth() {
    if ($this->preLoadInfo) {
        return $this->preLoadInfo[0];
    }
    elseif ($res = $this->getImage()) {
        return imagesx($res);
    }
    else {
        return NULL;
    }
}

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