PHP Class Bolt\Twig\Handler\ImageHandler

Afficher le fichier Open project: bolt/bolt Class Usage Examples

Méthodes publiques

Méthode 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

Méthode 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 méthode

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

image() public méthode

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
Résultat string Image path

imageInfo() public méthode

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

popup() public méthode

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
Résultat string HTML output

showImage() public méthode

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
Résultat string HTML output

thumbnail() public méthode

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.
Résultat string Relative URL of the thumbnail