PHP 클래스 mikehaertl\wkhtmlto\Image

This class is a slim wrapper around wkhtmltoimage.
저자: Michael Härtl ([email protected])
파일 보기 프로젝트 열기: mikehaertl/phpwkhtmltopdf 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$binary the name of the wkhtmltoimage binary. Default is wkhtmltoimage. You can also configure a full path here.
$commandOptions options to pass to the Command constructor. Default is none.
$ignoreWarnings whether to ignore any errors if some PDF file was still created. Default is false.
$tmpDir the directory to use for temporary files. If null (default) the dir is autodetected.
$type the image type. Default is 'png'. Other options are 'jpg' and 'bmp'.

보호된 프로퍼티들

프로퍼티 타입 설명
$_command the command instance that executes wkhtmltopdf
$_error the detailed error message. Empty string if none.
$_isCreated whether the PDF was created
$_options options for wkhtmltoimage as array('--opt1', '--opt2'=>'val', ...)
$_page the page input or a File instance for HTML string inputs
$_tmpImageFile the temporary image file

공개 메소드들

메소드 설명
__construct ( array | string $options = null )
getCommand ( ) : Command
getError ( ) : string
getImageFilename ( ) : string
getMimeType ( ) : string
saveAs ( string $filename ) : boolean Save the image to given filename (triggers image creation)
send ( string | null $filename = null, boolean $inline = false ) : boolean Send image to client, either inline or as download (triggers image creation)
setOptions ( array $options = [] ) : static Set options
setPage ( string $page ) : static Add a page object to the output

보호된 메소드들

메소드 설명
createImage ( ) : boolean Run the Command to create the tmp image file

메소드 상세

__construct() 공개 메소드

public __construct ( array | string $options = null )
$options array | string global options for wkhtmltoimage, a page URL, a HTML string or a filename

createImage() 보호된 메소드

Run the Command to create the tmp image file
protected createImage ( ) : boolean
리턴 boolean whether creation was successful

getCommand() 공개 메소드

public getCommand ( ) : Command
리턴 Command the command instance that executes wkhtmltopdf

getError() 공개 메소드

public getError ( ) : string
리턴 string the detailed error message. Empty string if none.

getImageFilename() 공개 메소드

public getImageFilename ( ) : string
리턴 string the filename of the temporary image file

getMimeType() 공개 메소드

public getMimeType ( ) : string
리턴 string the mime type for the current image

saveAs() 공개 메소드

Save the image to given filename (triggers image creation)
public saveAs ( string $filename ) : boolean
$filename string to save image as
리턴 boolean whether image was created successfully

send() 공개 메소드

Send image to client, either inline or as download (triggers image creation)
public send ( string | null $filename = null, boolean $inline = false ) : boolean
$filename string | null the filename to send. If empty, the PDF is streamed inline. Note, that the file extension must match what you configured as $type (png, jpg, ...).
$inline boolean whether to force inline display of the image, even if filename is present.
리턴 boolean whether image was created successfully

setOptions() 공개 메소드

Set options
public setOptions ( array $options = [] ) : static
$options array list of image options to set as name/value pairs
리턴 static the Image instance for method chaining

setPage() 공개 메소드

Add a page object to the output
public setPage ( string $page ) : static
$page string either a URL, a HTML string or a filename
리턴 static the Image instance for method chaining

프로퍼티 상세

$_command 보호되어 있는 프로퍼티

the command instance that executes wkhtmltopdf
protected $_command

$_error 보호되어 있는 프로퍼티

the detailed error message. Empty string if none.
protected $_error

$_isCreated 보호되어 있는 프로퍼티

whether the PDF was created
protected $_isCreated

$_options 보호되어 있는 프로퍼티

options for wkhtmltoimage as array('--opt1', '--opt2'=>'val', ...)
protected $_options

$_page 보호되어 있는 프로퍼티

the page input or a File instance for HTML string inputs
protected $_page

$_tmpImageFile 보호되어 있는 프로퍼티

the temporary image file
protected $_tmpImageFile

$binary 공개적으로 프로퍼티

the name of the wkhtmltoimage binary. Default is wkhtmltoimage. You can also configure a full path here.
public $binary

$commandOptions 공개적으로 프로퍼티

options to pass to the Command constructor. Default is none.
public $commandOptions

$ignoreWarnings 공개적으로 프로퍼티

whether to ignore any errors if some PDF file was still created. Default is false.
public $ignoreWarnings

$tmpDir 공개적으로 프로퍼티

the directory to use for temporary files. If null (default) the dir is autodetected.
public $tmpDir

$type 공개적으로 프로퍼티

the image type. Default is 'png'. Other options are 'jpg' and 'bmp'.
public $type