setOptions() public method

Set options
public setOptions ( array $options = [] ) : static
$options array list of image options to set as name/value pairs
return static the Image instance for method chaining
Example #1
0
 public function testCanSetOptions()
 {
     $inFile = $this->getHtmlAsset();
     $outFile = $this->getOutFile('png');
     $binary = $this->getBinary();
     $image = new Image();
     $image->setOptions(array('binary' => $binary, 'type' => 'png', 'transparent', 'width' => 800, 'allow' => array('/tmp', '/test')));
     $this->assertInstanceOf('mikehaertl\\wkhtmlto\\Image', $image->setPage($inFile));
     $this->assertTrue($image->saveAs($outFile));
     $tmpFile = $image->getimageFilename();
     $this->assertFileExists($outFile);
     $this->assertEquals("{$binary} --transparent --width '800' --allow '/tmp' --allow '/test' '{$inFile}' '{$tmpFile}'", (string) $image->getCommand());
     unlink($outFile);
 }
Example #2
0
 protected function setScreenshot($domain)
 {
     $options = ["type" => "jpg", "ignoreWarnings" => true];
     $image = new Image($this->domain);
     $image->setOptions($options);
     $imageURL = 'images/' . $domain . '.jpg';
     $image->saveAs($imageURL);
     if (is_readable($imageURL)) {
         return $imageURL;
     }
     return false;
 }