BitmapFormat
class BitmapFormat (View source)
Helper class for bitmap image formats.
Constants
FORMAT_PNG |
Bitmap image format: PNG. |
FORMAT_JPEG |
Bitmap image format: JPEG. |
FORMAT_WEBP |
Bitmap image format: WEBP. |
FORMAT_GIF |
Bitmap image format: GIF. |
FORMAT_WBMP |
Bitmap image format: WBMP. |
FORMAT_XBM |
Bitmap image format: XBM. |
DEFAULT_JPEG_QUALITY |
Default JPEG quality (from 0 to 100) - to be used when there's no (valid) configured value. |
DEFAULT_WEBP_QUALITY |
Default WEBP quality (from 0 to 100) - to be used when there's no (valid) configured value. |
DEFAULT_PNG_COMPRESSIONLEVEL |
Default PNG compression level (from 0 to 9) - to be used when there's no (valid) configured value. |
Properties
protected Repository | $config | ||
protected Numbers | $valn | ||
protected string[]|null | $allImageFormats | All the image formats (if initialized). |
Methods
Get all the image formats.
Check if a format identifier is valid.
Get the MIME type for a specific format.
Get the bitmap format corresponding to a specific MIME type.
Get the Imagine save options for the specified image format.
Get the file extension for the specified format.
Set the default JPEG quality.
Get the default JPEG quality.
Set the default WEBP quality.
Get the default WEBP quality.
Set the default PNG compression level.
Get the default PNG compression level.
Normalize a format.
Details
__construct(Repository $config, Numbers $valn)
Initialize the instance.
string[]
getAllImageFormats()
Get all the image formats.
bool
isFormatValid(string|mixed $format)
Check if a format identifier is valid.
string
getFormatMimeType(string $format)
Get the MIME type for a specific format.
string|mixed
getFormatFromMimeType(string $mimeType, mixed $fallback = '')
Get the bitmap format corresponding to a specific MIME type.
array
getFormatImagineSaveOptions(string $format)
Get the Imagine save options for the specified image format.
string
getFormatFileExtension(string $format)
Get the file extension for the specified format.
$this
setDefaultJpegQuality(int $value)
Set the default JPEG quality.
int
getDefaultJpegQuality()
Get the default JPEG quality.
$this
setDefaultWebpQuality(int $value)
Set the default WEBP quality.
int
getDefaultWebpQuality()
Get the default WEBP quality.
$this
setDefaultPngCompressionLevel(int $value)
Set the default PNG compression level.
int
getDefaultPngCompressionLevel()
Get the default PNG compression level.
protected string
normalizeFormat(string|mixed $format)
Normalize a format.