PHP Class Spatie\Browsershot\Browsershot

显示文件 Open project: spatie/browsershot Class Usage Examples

Protected Properties

Property Type Description
$backgroundColor string
$binPath string
$height integer
$quality integer
$timeout integer
$url integer

Public Methods

Method Description
__construct ( $binPath = '', $width = 640, $height = 480, $quality = 60, $timeout = 5000, $backgroundColor = null )
save ( string $targetFile ) : boolean Convert the webpage to an image.
setBackgroundColor ( string $backgroundColor ) Set the background color.
setBinPath ( string $binPath )
setHeight ( integer $height )
setHeightToRenderWholePage ( ) Set to height so the whole page will be rendered.
setQuality ( $quality ) Set the image quality.
setTimeout ( integer $timeout )
setUrl ( string $url )
setWidth ( integer $width )

Protected Methods

Method Description
getPhantomJsScript ( string $targetFile ) : string Get the script to be executed by phantomjs.
takeScreenShot ( $targetFile ) Take the screenshot.

Method Details

__construct() public method

public __construct ( $binPath = '', $width = 640, $height = 480, $quality = 60, $timeout = 5000, $backgroundColor = null )

getPhantomJsScript() protected method

Get the script to be executed by phantomjs.
protected getPhantomJsScript ( string $targetFile ) : string
$targetFile string
return string

save() public method

Convert the webpage to an image.
public save ( string $targetFile ) : boolean
$targetFile string The path of the file where the screenshot should be saved
return boolean

setBackgroundColor() public method

Set the background color.
public setBackgroundColor ( string $backgroundColor )
$backgroundColor string

setBinPath() public method

public setBinPath ( string $binPath )
$binPath string

setHeight() public method

public setHeight ( integer $height )
$height integer

setHeightToRenderWholePage() public method

Set to height so the whole page will be rendered.

setQuality() public method

Set the image quality.
public setQuality ( $quality )
$quality

setTimeout() public method

public setTimeout ( integer $timeout )
$timeout integer

setUrl() public method

public setUrl ( string $url )
$url string

setWidth() public method

public setWidth ( integer $width )
$width integer

takeScreenShot() protected method

Take the screenshot.
protected takeScreenShot ( $targetFile )
$targetFile

Property Details

$backgroundColor protected_oe property

protected string $backgroundColor
return string

$binPath protected_oe property

protected string $binPath
return string

$height protected_oe property

protected int $height
return integer

$quality protected_oe property

protected int $quality
return integer

$timeout protected_oe property

protected int $timeout
return integer

$url protected_oe property

protected int $url
return integer