public function Image::createNew in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Image/Image.php \Drupal\Core\Image\Image::createNew()
Prepares a new image, without loading it from a file.
For a working example, see \Drupal\system\Plugin\ImageToolkit\Operation\gd\CreateNew.
Parameters
int $width: The width of the new image, in pixels.
int $height: The height of the new image, in pixels.
string $extension: (Optional) The extension of the image file (e.g. 'png', 'gif', etc.). Allowed values depend on the implementation of the image toolkit. Defaults to 'png'.
string $transparent_color: (Optional) The hexadecimal string representing the color to be used for transparency, needed for GIF images. Defaults to '#ffffff' (white).
Return value
bool TRUE on success, FALSE on failure.
Overrides ImageInterface::createNew
File
- core/
lib/ Drupal/ Core/ Image/ Image.php, line 154 - Contains \Drupal\Core\Image\Image.
Class
- Image
- Defines an image object to represent an image file.
Namespace
Drupal\Core\ImageCode
public function createNew($width, $height, $extension = 'png', $transparent_color = '#ffffff') {
return $this
->apply('create_new', array(
'width' => $width,
'height' => $height,
'extension' => $extension,
'transparent_color' => $transparent_color,
));
}