mikehaertl\wkhtmlto\Image::getImageFilename PHP Method

getImageFilename() public method

public getImageFilename ( ) : string
return string the filename of the temporary image file
    public function getImageFilename()
    {
        if ($this->_tmpImageFile === null) {
            $this->_tmpImageFile = new File('', '.' . $this->type, self::TMP_PREFIX);
        }
        return $this->_tmpImageFile->getFileName();
    }

Usage Example

示例#1
0
 public function testCanUseXvfbRun()
 {
     $inFile = $this->getHtmlAsset();
     $outFile = $this->getOutFile('png');
     $binary = $this->getBinary();
     $image = new Image(array('binary' => $binary, 'commandOptions' => array('enableXvfb' => true)));
     $this->assertInstanceOf('mikehaertl\\wkhtmlto\\Image', $image->setPage($inFile));
     $this->assertTrue($image->saveAs($outFile));
     $tmpFile = $image->getImageFilename();
     $command = (string) $image->getCommand();
     $this->assertEquals("xvfb-run --server-args=\"-screen 0, 1024x768x24\" {$binary} '{$inFile}' '{$tmpFile}'", $command);
     unlink($outFile);
 }