You are here

public function TinyPng::setFromFile in TinyPNG 8

Compress with \Tinify\fromFile.

Parameters

string $uri: URI of file.

Return value

$this Current instance.

Overrides TinyPngInterface::setFromFile

File

src/TinyPng.php, line 113

Class

TinyPng
Class TinyPng.

Namespace

Drupal\tinypng

Code

public function setFromFile($uri) {
  $this
    ->setApiKey();
  $path = $this->fileSystem
    ->realpath($uri);
  $this->tinyfySource = TinifyFromFile($path);
  return $this;
}