ImageLoader
in package
implements
LoggerAwareInterface
Uses
LoggerAwareTrait
Base class for loading images (shared by Cover\Loader and QRCode\Loader)
Tags
Interfaces, Classes, Traits and Enums
- LoggerAwareInterface
Table of Contents
- $allowedFileExtensions : array<string|int, mixed>
- Array containing map of allowed file extensions to mimetypes (to be extended)
- $configuredFailImage : string
- User-configured image to load from theme on error.
- $contentType : string
- Content type of data in $image property
- $defaultFailImage : string
- Default image to load from theme if user-configured option fails.
- $image : string
- Property for storing raw image data; may be null if image is unavailable
- $themeTools : ThemeInfo
- Theme tools
- getContentType() : string
- Get the content type of the current image (not meant to be called until after contentType is populated)
- getImage() : string
- Get the image data (not meant to be called until after image is populated)
- loadUnavailable() : void
- Load the user-specified "cover unavailable" graphic (or default if none specified).
- setThemeInfo() : void
- Setter for dependency
- debug() : void
- Log a debug message.
- getContentTypeFromExtension() : string
- Get the content-type for a file based on extension. Throw an exception if an illegal extension is provided.
- loadDefaultFailImage() : void
- Display the default "cover unavailable" graphic.
- log() : void
- Send a message to the logger.
- logError() : void
- Log an error message.
- logWarning() : void
- Log a warning message.
- searchTheme() : string|bool
- Find a file in the themes (return false if no file exists).
Properties
$allowedFileExtensions
Array containing map of allowed file extensions to mimetypes (to be extended)
protected
array<string|int, mixed>
$allowedFileExtensions
= ['gif' => 'image/gif', 'jpeg' => 'image/jpeg', 'jpg' => 'image/jpeg', 'png' => 'image/png', 'tiff' => 'image/tiff', 'tif' => 'image/tiff']
$configuredFailImage
User-configured image to load from theme on error.
protected
string
$configuredFailImage
= null
$contentType
Content type of data in $image property
protected
string
$contentType
= null
$defaultFailImage
Default image to load from theme if user-configured option fails.
protected
string
$defaultFailImage
= 'images/noCover2.gif'
$image
Property for storing raw image data; may be null if image is unavailable
protected
string
$image
= null
$themeTools
Theme tools
protected
ThemeInfo
$themeTools
= null
Methods
getContentType()
Get the content type of the current image (not meant to be called until after contentType is populated)
public
getContentType() : string
Return values
string —getImage()
Get the image data (not meant to be called until after image is populated)
public
getImage() : string
Return values
string —loadUnavailable()
Load the user-specified "cover unavailable" graphic (or default if none specified).
public
loadUnavailable() : void
Tags
Return values
void —setThemeInfo()
Setter for dependency
public
setThemeInfo(ThemeInfo $theme) : void
Parameters
- $theme : ThemeInfo
-
VuFind theme tools
Return values
void —debug()
Log a debug message.
protected
debug(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
- $msg : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = true
-
Prepend class name to message?
Return values
void —getContentTypeFromExtension()
Get the content-type for a file based on extension. Throw an exception if an illegal extension is provided.
protected
getContentTypeFromExtension(string $filename) : string
Parameters
- $filename : string
-
Filename to analyze.
Tags
Return values
string —loadDefaultFailImage()
Display the default "cover unavailable" graphic.
protected
loadDefaultFailImage() : void
Return values
void —log()
Send a message to the logger.
protected
log(string $level, string $message[, array<string|int, mixed> $context = [] ][, bool $prependClass = false ]) : void
Parameters
- $level : string
-
Log level
- $message : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = false
-
Prepend class name to message?
Return values
void —logError()
Log an error message.
protected
logError(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
- $msg : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = true
-
Prepend class name to message?
Return values
void —logWarning()
Log a warning message.
protected
logWarning(string $msg[, array<string|int, mixed> $context = [] ][, bool $prependClass = true ]) : void
Parameters
- $msg : string
-
Log message
- $context : array<string|int, mixed> = []
-
Log context
- $prependClass : bool = true
-
Prepend class name to message?
Return values
void —searchTheme()
Find a file in the themes (return false if no file exists).
protected
searchTheme(string $path[, array<string|int, mixed> $formats = [''] ]) : string|bool
Parameters
- $path : string
-
Relative path of file to find.
- $formats : array<string|int, mixed> = ['']
-
Optional array of suffixes to add to $path while searching theme (used to check multiple extensions in each theme).