Since: 1.3.0

abstract class AbstractCallbacks (View source)

Used for looking up and saving hashes related to a local image.

Inject an inherited object of this into new TemplateHelper(), by default \Rokka\Client\TemplateHelper\DefaultCallbacks is used.

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

abstract null|string getHash(AbstractLocalImage $image)

Since: 1.3.0

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

abstract string saveHash(AbstractLocalImage $image, SourceImage $sourceImage)

Since: 1.3.0

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