function GDToolkit::setType

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

Sets the PHP type of the image.

Parameters

int $type: The image type represented by a PHP IMAGETYPE_* constant (e.g. IMAGETYPE_JPEG).

Return value

$this

1 call to GDToolkit::setType()
GDToolkit::parseFile in core/modules/system/src/Plugin/ImageToolkit/GDToolkit.php
Determines if a file contains a valid image.

File

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

Class

GDToolkit
Defines the GD2 toolkit for image manipulation within Drupal.

Namespace

Drupal\system\Plugin\ImageToolkit

Code

public function setType($type) {
    if (in_array($type, static::supportedTypes())) {
        $this->type = $type;
    }
    return $this;
}

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