$basedir
$basedir : string
The base directory we store comics in.
Klutz Driver implementation for comics as files with SUM info stored in SQL database.
Required parameters:
'directory' The main directory the comics are stored in
factory(string $driver = null, array $params = null) : object
Gets a concrete Klutz_Driver instance.
string | $driver | The type of concrete Klutz_Driver subclass to return. The code for the driver is dynamically included. |
array | $params | A hash containing any additional configuration or connection parameters a subclass might need |
Klutz_Driver The newly created concrete instance, or false on error.
listDates(\timestamp $date = null, \timestamp $oldest = null, \timestamp $newest = null) : mixed
Get a list of the dates for which we have comics between $oldest and $newest. Only returns dates we have at least one comic for.
\timestamp | $date | The reference date (default today) |
\timestamp | $oldest | The earliest possible date to return (default first of the month) |
\timestamp | $newest | The latest possible date to return (default last date of the month) |
An array of dates in $subdir format between $oldest and $newest that we have comics for | PEAR_Error
imageSize(string $index, \timestamp $date = null) : string
Get the image dimensions for the requested image.
The image is not stored locally so this function returns an empty string. Performance hit is too expensive to make this worth it.
string | $index | The index of the comic to check |
\timestamp | $date | The date of the comic to check (default today) |
Attributes for an tag giving height and width
imageExists(string $index, \timestamp $date = null) : boolean
Find out if we already have a local copy of this image.
Even though we never actually store a local copy, pretend.
string | $index | The index of the comic to check |
\timestamp | $date | The date of the comic to check (default today) |
False in this driver
storeImage(string $index, string $image, $date = null) : boolean
Store an image for later retrieval.
Even though we never actually store a local copy, pretend.
string | $index | The index of the comic to retrieve |
string | $image | Raw (binary) image data to store |
$date |
True on success, false otherwise
retrieveImage(string $index, \timestamp $date = null) : mixed
Retrieve an image from storage. Make sure the image exists first with imageExists().
string | $index | The index of the comic to retrieve |
\timestamp | $date | The date for which we want $comic |
If the image exists locally, return a Klutz_Image object. If it doesn't, return a string with the URL pointing to the comic.
addSum(string $index, \timestamp $date, string $data) : boolean|\PEAR_Error
Add a unique identifier for a given image.
string | $index | The index for the comic |
\timestamp | $date | The date of the comic |
string | $data | The md5 of the raw (binary) image data |
True on success, PEAR_Error on failure.
removeSum(string $index = null, \timestamp $date = null) : integer|\PEAR_Error
Remove the unique identifier for the given comic and/or date. If both are passed, removes the uid for that comic and date. If only a comic is passed, removes all uids for that comic. If only a date is passed removes uids for all comics on that date. If neither is passed, all uids are wiped out.
string | $index | Index for the comic to delete. If left out all comics will be assumed. |
\timestamp | $date | Date to remove. If left out, assumes all dates. |
number of affected Comics on success, PEAR_Error on failure.
isUnique(\Klutz_Image $image) : boolean
Determine if the image passed is a unique image (one we don't already have).
This allows for $days = random, etc., but keeps us from getting the same comic day after day.
\Klutz_Image | $image | Raw (binary) image data. |
True if unique, false otherwise.
removeImage(string $index, \timestamp $date = null) : boolean
Remove an image from the storage system (including its unique ID).
string | $index | The index of the comic to remove |
\timestamp | $date | The date of the comic to remove (default today) |
True on success, else false