function TestToolkit::parseFile
Same name and namespace in other branches
- 9 core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/TestToolkit.php \Drupal\image_test\Plugin\ImageToolkit\TestToolkit::parseFile()
- 8.9.x core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/TestToolkit.php \Drupal\image_test\Plugin\ImageToolkit\TestToolkit::parseFile()
- 11.x core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/TestToolkit.php \Drupal\image_test\Plugin\ImageToolkit\TestToolkit::parseFile()
Determines if a file contains a valid image.
Drupal supports GIF, JPG and PNG file formats when used with the GD toolkit, and may support others, depending on which toolkits are installed.
Return value
bool TRUE if the file could be found and is an image, FALSE otherwise.
Overrides ImageToolkitInterface::parseFile
File
-
core/
modules/ system/ tests/ modules/ image_test/ src/ Plugin/ ImageToolkit/ TestToolkit.php, line 134
Class
- TestToolkit
- Defines a Test toolkit for image manipulation within Drupal.
Namespace
Drupal\image_test\Plugin\ImageToolkitCode
public function parseFile() {
$this->logCall('parseFile', func_get_args());
$data = @getimagesize($this->getSource());
if ($data && in_array($data[2], static::supportedTypes())) {
$this->setType($data[2]);
$this->width = $data[0];
$this->height = $data[1];
return TRUE;
}
return FALSE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.