function ImageInterface::createNew

Same name in other branches
  1. 9 core/lib/Drupal/Core/Image/ImageInterface.php \Drupal\Core\Image\ImageInterface::createNew()
  2. 10 core/lib/Drupal/Core/Image/ImageInterface.php \Drupal\Core\Image\ImageInterface::createNew()
  3. 11.x core/lib/Drupal/Core/Image/ImageInterface.php \Drupal\Core\Image\ImageInterface::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 (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).

Return value

bool TRUE on success, FALSE on failure.

1 method overrides ImageInterface::createNew()
Image::createNew in core/lib/Drupal/Core/Image/Image.php
Prepares a new image, without loading it from a file.

File

core/lib/Drupal/Core/Image/ImageInterface.php, line 131

Class

ImageInterface
Provides an interface for image objects.

Namespace

Drupal\Core\Image

Code

public function createNew($width, $height, $extension = 'png', $transparent_color = '#ffffff');

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