PHP Class PartKeepr\ImageBundle\Controller\ImageController

Inheritance: extends PartKeepr\UploadedFileBundle\Controller\FileController
Exibir arquivo Open project: partkeepr/PartKeepr

Public Methods

Method 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.

Protected Methods

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

Method Details

ensureCacheDirExists() public method

Ensures that the image cache directory exists.

fitWithin() public method

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).
return string The path to the scaled file

getImageAction() public method

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

getImageCacheDirectory() public method

Returns the path to the image cache directory.
public getImageCacheDirectory ( ) : string
return string

getImageCacheFilename() public method

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
return string

hasCacheFile() protected method

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