PdImage
in package
Table of Contents
Methods
- __construct() : mixed
- PdImage constructor.
- delete() : void
- Deletes the stored image file if it exists.
- get() : string|null
- Returns the relative image path (with cache-busting timestamp) if the image exists.
- getAcceptList() : string
- Returns a comma-separated list of accepted file extensions for input[type="file"] accept attribute.
- rotate() : void
- Rotates the image by 90 degrees (left or right).
- upload() : array<string|int, mixed>
- Handles image upload, - Converts it to JPEG - Resizes it - Saves it in the appropriate client directory
- getAbsoluteFilePath() : string
- Returns the absolute file path for the current image.
- getFilename() : string
- Returns the id as filename for the current pd.
- getStorage() : string|null
- Returns the absolute file path to the image storage directory.
- getStorageRelative() : string
- Returns the relative web path to the image storage directory.
Methods
__construct()
PdImage constructor.
public
__construct(int $clientId, int $pdId) : mixed
Parameters
- $clientId : int
-
The ID of the client
- $pdId : int
-
The ID of the care report
delete()
Deletes the stored image file if it exists.
public
delete() : void
get()
Returns the relative image path (with cache-busting timestamp) if the image exists.
public
get() : string|null
Return values
string|null —Relative path with timestamp or null if file doesn't exist
getAcceptList()
Returns a comma-separated list of accepted file extensions for input[type="file"] accept attribute.
public
getAcceptList() : string
Return values
string —File extension list
rotate()
Rotates the image by 90 degrees (left or right).
public
rotate([bool $l = true ]) : void
Parameters
- $l : bool = true
-
If true, rotate left (90°); otherwise, rotate right (-90°)
upload()
Handles image upload, - Converts it to JPEG - Resizes it - Saves it in the appropriate client directory
public
upload(string $fieldname) : array<string|int, mixed>
Parameters
- $fieldname : string
-
The name of the file input field
Return values
array<string|int, mixed> —Associative array with filename, absolute/relative paths, and error list
getAbsoluteFilePath()
Returns the absolute file path for the current image.
protected
getAbsoluteFilePath() : string
Return values
stringgetFilename()
Returns the id as filename for the current pd.
protected
getFilename() : string
Return values
stringgetStorage()
Returns the absolute file path to the image storage directory.
protected
getStorage() : string|null
Return values
string|null —Absolute path or null if not found
getStorageRelative()
Returns the relative web path to the image storage directory.
protected
getStorageRelative() : string
Return values
string —Relative path