Since: 1.3.0

class DefaultCallbacks extends AbstractCallbacks (View source)

The default implementation for \Rokka\Client\TemplateHelper\AbstractCallbacks.

It stores the hash to an image on the filesystem as json. Either next to the image, if it's on the filesystem, otherwise in the sys_get_temp_dir().

Properties

static string $fileExtension

Methods

null|string
getHash(AbstractLocalImage $image)

Callback when a "local" image needs its hash.

string
saveHash(AbstractLocalImage $image, SourceImage $sourceImage)

This method is called, when an image was saved/uploaded to the rokka server.

array
getMetadata(AbstractLocalImage $image)

Return an array of metadata to be sent to the rokka server.

Details

null|string getHash(AbstractLocalImage $image)

Callback when a "local" image needs its hash.

Look up if the hash is stored in the right place (DB or similar) and return it. If not stored, return null, so that the picture will be uploaded.

Parameters

AbstractLocalImage $image

Return Value

null|string

string saveHash(AbstractLocalImage $image, SourceImage $sourceImage)

This method is called, when an image was saved/uploaded to the rokka server.

This is the place, where you would store the hash in the right place (DB or similar). Has to return the hash or short hash.

Parameters

AbstractLocalImage $image

The "local" image

SourceImage $sourceImage

The SourceImage on the rokka server with all needed meta info

Return Value

string

hash or shorthash

array getMetadata(AbstractLocalImage $image)

Since: 1.3.0 If you want to send special metadata to the rokka server for later searching, you can return them here. Will be called, before an image is uploaded to rokka.

Return an array of metadata to be sent to the rokka server.

Parameters

AbstractLocalImage $image

Return Value

array