PHP Class PHPePub\Helpers\ImageHelper

Datei anzeigen Open project: grandt/phpepub Class Usage Examples

Protected Properties

Property Type Description
$isAnimatedGifResizeInstalled
$isExifInstalled
$isGdInstalled

Public Methods

Method Description
getImage ( EPub $book, string $imageSource ) : array | boolean Get an image from a file or url, return it resized if the image exceeds the $maxImageWidth or $maxImageHeight directives.
getImageFileTypeFromBinary ( object $binary ) : string get mime type from image data
getImageScale ( $width, $height, $maxImageWidth, $maxImageHeight ) : float Scale image dimensions if they exceed the max image constraints.
handleSVGAttribs ( SimpleXMLElement $svg ) : array
isAnimatedGifResizeInstalled ( ) : boolean
isExifInstalled ( ) : mixed
isGdInstalled ( ) : mixed
scaleSVGUnit ( $length, integer $portSize = 512 ) : float Copyright WikiMedia: https://doc.wikimedia.org/mediawiki-core/master/php/SVGMetadataExtractor_8php_source.html
splitCSV ( $attr, string $sep = ',' ) : array

Method Details

getImage() public static method

The return value is an array. ['width'] is the width of the image. ['height'] is the height of the image. ['mime'] is the mime type of the image. Resized images are always in jpeg format. ['image'] is the image data. ['ext'] is the extension of the image file.
public static getImage ( EPub $book, string $imageSource ) : array | boolean
$book PHPePub\Core\EPub
$imageSource string path or url to file.
return array | boolean

getImageFileTypeFromBinary() public static method

By fireweasel found on http://stackoverflow.com/questions/2207095/get-image-mimetype-from-resource-in-php-gd
public static getImageFileTypeFromBinary ( object $binary ) : string
$binary object
return string

getImageScale() public static method

Scale image dimensions if they exceed the max image constraints.
public static getImageScale ( $width, $height, $maxImageWidth, $maxImageHeight ) : float
$width
$height
$maxImageWidth
$maxImageHeight
return float

handleSVGAttribs() public static method

public static handleSVGAttribs ( SimpleXMLElement $svg ) : array
$svg SimpleXMLElement
return array

isAnimatedGifResizeInstalled() public static method

public static isAnimatedGifResizeInstalled ( ) : boolean
return boolean

isExifInstalled() public static method

public static isExifInstalled ( ) : mixed
return mixed

isGdInstalled() public static method

public static isGdInstalled ( ) : mixed
return mixed

scaleSVGUnit() public static method

Copyright WikiMedia: https://doc.wikimedia.org/mediawiki-core/master/php/SVGMetadataExtractor_8php_source.html
public static scaleSVGUnit ( $length, integer $portSize = 512 ) : float
$length
$portSize integer
return float

splitCSV() public static method

public static splitCSV ( $attr, string $sep = ',' ) : array
$attr
$sep string
return array

Property Details

$isAnimatedGifResizeInstalled protected_oe static_oe property

protected static $isAnimatedGifResizeInstalled

$isExifInstalled protected_oe static_oe property

protected static $isExifInstalled

$isGdInstalled protected_oe static_oe property

protected static $isGdInstalled