You are here

public function Textimage::setSourceImageFile in Textimage 8.4

Same name and namespace in other branches
  1. 8.3 src/Textimage.php \Drupal\textimage\Textimage::setSourceImageFile()

Sets the image source file.

Parameters

\Drupal\file\FileInterface $source_image_file: A file entity.

int|null $width: (optional) The source image width if known. Defaults to NULL.

int|null $height: (optional) The source image height if known. Defaults to NULL.

Return value

$this

Overrides TextimageInterface::setSourceImageFile

File

src/Textimage.php, line 342

Class

Textimage
Provides a Textimage.

Namespace

Drupal\textimage

Code

public function setSourceImageFile(FileInterface $source_image_file, $width = NULL, $height = NULL) {
  if ($source_image_file) {
    $this
      ->set('sourceImageFile', $source_image_file);
  }
  if ($width && $height) {
    $this
      ->set('width', $width);
    $this
      ->set('height', $height);
  }
  return $this;
}