PHP Class Bolt\Twig\Handler\ImageHandler

Datei anzeigen Open project: bolt/bolt Class Usage Examples

Public Methods

Method Description
__construct ( Silex\Application $app )
image ( string $fileName = null, string | integer $width = null, string | integer $height = null, string $crop = null ) : string Helper function to make a path to an image.
imageInfo ( string $fileName, string $safe ) : Bolt\Filesystem\Handler\ImageInterface Get an image.
popup ( string | array $fileName = null, integer $width = null, integer $height = null, string $crop = null, string $title = null ) : string Helper function to wrap an image in a Magnific popup HTML tag, with thumbnail.
showImage ( string $fileName = null, integer $width = null, integer $height = null, string $crop = null ) : string Helper function to show an image on a rendered page.
thumbnail ( string $fileName = null, string | integer $width = null, string | integer $height = null, string $crop = null ) : string Helper function to make a path to an image thumbnail.

Private Methods

Method Description
getAliasedUri ( mixed $filename, string $alias ) : mixed Get the thumbnail relative URI, using an alias.
getThumbnail ( string | array $fileName = null, integer $width = null, integer $height = null, string $scale = null ) : Bolt\Helpers\Image\Thumbnail Get a thumbnail object.
getThumbnailUri ( Bolt\Helpers\Image\Thumbnail $thumb ) : mixed Get the thumbnail relative URI, using width, height and action.
isAlias ( $alias )

Method Details

__construct() public method

public __construct ( Silex\Application $app )
$app Silex\Application

image() public method

Helper function to make a path to an image.
public image ( string $fileName = null, string | integer $width = null, string | integer $height = null, string $crop = null ) : string
$fileName string Target filename
$width string | integer Target width
$height string | integer Target height
$crop string String identifier for cropped images
return string Image path

imageInfo() public method

Get an image.
public imageInfo ( string $fileName, string $safe ) : Bolt\Filesystem\Handler\ImageInterface
$fileName string
$safe string
return Bolt\Filesystem\Handler\ImageInterface

popup() public method

example: {{ content.image|popup(320, 240) }} example: {{ popup(content.image, 320, 240) }} example: {{ content.image|popup(width=320, height=240, title="My Image") }}
public popup ( string | array $fileName = null, integer $width = null, integer $height = null, string $crop = null, string $title = null ) : string
$fileName string | array Image file name
$width integer Image width
$height integer Image height
$crop string Crop image string identifier
$title string Display title for image
return string HTML output

showImage() public method

Set width or height parameter to '0' for proportional scaling. Set them both to null (or not at all) to get the default size from config.yml. Example: {{ content.image|showimage(320, 240) }} Example: {{ showimage(content.image, 320, 240) }}
public showImage ( string $fileName = null, integer $width = null, integer $height = null, string $crop = null ) : string
$fileName string Image filename
$width integer Image width
$height integer Image height
$crop string Crop image string identifier
return string HTML output

thumbnail() public method

Helper function to make a path to an image thumbnail.
public thumbnail ( string $fileName = null, string | integer $width = null, string | integer $height = null, string $crop = null ) : string
$fileName string Target filename
$width string | integer Target width
$height string | integer Target height
$crop string Zooming and cropping: Set to 'f(it)', 'b(orders)', 'r(esize)' or 'c(rop)' Set width or height parameter to '0' for proportional scaling Setting them to '' uses default values.
return string Relative URL of the thumbnail