PHP Class PartKeepr\ImageBundle\Controller\ImageController

Inheritance: extends PartKeepr\UploadedFileBundle\Controller\FileController
Afficher le fichier Open project: partkeepr/PartKeepr

Méthodes publiques

Méthode Description
ensureCacheDirExists ( ) Ensures that the image cache directory exists.
fitWithin ( UploadedFile $image, integer $width, integer $height, boolean $padding = false ) : string Scales the image to fit within the given size.
getImageAction ( Request $request, $id ) : ImageResponse | Response
getImageCacheDirectory ( ) : string Returns the path to the image cache directory.
getImageCacheFilename ( UploadedFile $image, integer $width, integer $height, string $mode ) : string Returns the path to an image which has been cached in a particular width, height and mode.

Méthodes protégées

Méthode Description
hasCacheFile ( UploadedFile $image, $width, $height, $mode ) : boolean Checks if the database contains the cache file.

Method Details

ensureCacheDirExists() public méthode

Ensures that the image cache directory exists.

fitWithin() public méthode

Scales the image to fit within the given size.
public fitWithin ( UploadedFile $image, integer $width, integer $height, boolean $padding = false ) : string
$image PartKeepr\UploadedFileBundle\Entity\UploadedFile The image to scale
$width integer The width
$height integer The height
$padding boolean If true, pad the output image to the given size (transparent background).
Résultat string The path to the scaled file

getImageAction() public méthode

public getImageAction ( Request $request, $id ) : ImageResponse | Response
$request Symfony\Component\HttpFoundation\Request
$id
Résultat PartKeepr\ImageBundle\Response\ImageResponse | Symfony\Component\HttpFoundation\Response

getImageCacheDirectory() public méthode

Returns the path to the image cache directory.
public getImageCacheDirectory ( ) : string
Résultat string

getImageCacheFilename() public méthode

Returns the path to an image which has been cached in a particular width, height and mode.
public getImageCacheFilename ( UploadedFile $image, integer $width, integer $height, string $mode ) : string
$image PartKeepr\UploadedFileBundle\Entity\UploadedFile The image
$width integer The width
$height integer The height
$mode string The mode
Résultat string

hasCacheFile() protected méthode

Checks if the database contains the cache file.
protected hasCacheFile ( UploadedFile $image, $width, $height, $mode ) : boolean
$image PartKeepr\UploadedFileBundle\Entity\UploadedFile
$width
$height
$mode
Résultat boolean