public Image::createNew($width, $height, $extension = 'png', $transparent_color = '#ffffff')
Prepares a new image, without loading it from a file.
For a working example, see \Drupal\system\Plugin\ImageToolkit\Operation\gd\CreateNew.
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 (for instance, '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).
bool TRUE on success, FALSE on failure.
Overrides ImageInterface::createNew
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)); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Image!Image.php/function/Image::createNew/8.1.x