Skip to content

Instantly share code, notes, and snippets.

@fabn
Created January 10, 2012 13:58
Show Gist options
  • Save fabn/1589218 to your computer and use it in GitHub Desktop.
Save fabn/1589218 to your computer and use it in GitHub Desktop.
How to retrieve a previously submitted job
<?php
try {
$webthumb = new Bluga_Webthumb();
$webthumb->setApiKey($APIKEY);
$job = $webthumb->addUrl($url,'medium2', 1024, 768);
$job->options->notify = "Your notify url";
$webthumb->submitRequests();
// save the job to retrieve it later
file_put_contents('/tmp/thumbjob.txt', serialize($job));
// later in the notified scripts
$theJob = unserialize(file_get_contents('/tmp/thumbjob.txt'));
$webthumb = new Bluga_Webthumb();
$webthumb->setApiKey($APIKEY);
$webthumb->addJob($job);
$webthumb->fetchToFile($job, '/tmp/image.png');
} catch (Exception $e) {
var_dump($e->getMessage());
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment