You are here

public function GDToolkit::setType 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::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 374

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