The Ethumb library allows the creation of thumbnail images of files.
Syntax
efl.Ethumb.initClient();
Initializes the Ethumb client library.
Syntax
function mycallback(client, success) { ... }; efl.Ethumb.connectClient(mycallback);
Parameters
disconnect()
method.Return value
callback
is missing it returns NULL. If it fail for other conditions, NULL is also returned and callback
is called with success=false
. The client instance is not ready to be used until callback
is called.Connects to Ethumb server and return the client instance.
This is the âconstructorâ of Ethumb Clients, where everything starts.
If server was down, it is tried to start it using DBus activation, then the connection is retried.
This call is asynchronous and will not block, instead it will be in ânot connectedâ state until callback
is called with either success or failure. On failure, then no methods should be called. On success you're now able to setup and then ask generation of thumbnails.
Usually you should listen for server death/disconenction with the setOnServerDieCallback()
method.
Syntax
efl.Ethumb.shutdownClient();
Shuts down the Ethumb client library.
Syntax
clientObj.cancelAllGenerate()
Ask server to cancel generation of all thumbnails.
Syntax
function callback(success) {...}; clientObj.cancelGenerate(id, callback);
Parameters
generate()
;Ask server to cancel generation of a thumbnail.
Syntax
clientObj.disconnect();
Disconnect the client, releasing all client resources.
This is the destructor of Ethumb Client, after it's disconnected the client handle is now gone and should not be used.
Syntax
function callback(client, existsInfo, exists) {...}; clientObj.existsThumb(callback);
Parameters
Return value
Checks whenever file already exists (locally!)
This will check locally (not calling server) if thumbnail already exists or not, also calculating the thumbnail path. Path must be configured with setFile()
before using it and the last set file will be used!
Syntax
clientObj.freeFile();
Reset previously set file to NULL.
Syntax
function callback(client, id, file, key, thumb_path, thumb_key, success) {...}; var id = clientObj.generate(callback);
Parameters
Return value
Ask server to generate a thumbnail.
This process is asynchronous and will report back from main loop using callback
. One can cancel this request by calling cancelGenerate()
or cancelAllGenerate()
, but not that request might be processed by server already and no generated files will be removed if that is the case.
This will not check if file already exists, this should be done by explicitly calling existsThumb()
That is, this function will override any existing thumbnail.
Syntax
var info = clientObj.getFile();
Return value
path
and key
.
Gets the info from setFile()
method.
Syntax
function callback(client, path, key) {...}; clientObj.getThumbAsync(callback);
Parameters
Return value
Syntax
var ok = clientObj.setFile(path, key);
Parameters
Return value
true
on success, false
on failure.Set source file to be thumbnailed.
Calling this function has the side effect of resetting values auto-generated with existsThumb()
method.
Syntax
function callback(client) { ... } clientObj.setOnServerDieCallback(callback);
Parameters
Sets the callback to report server died.
When the server dies there is nothing you can do, just release resources with disconnect()
and probably try to connect again.
Usually, you should set this callback and handle this case, it does happen!
Syntax
existsObj.cancel();
Cancel an ongoing exists request.
Syntax
existsObj.check();
Check if an exists request was cancelled.