I'm working on image processing with PHP, the steps are:
My problem:
I'm using Gearman, is it correct to have a worker for imagemagick, another worker for jpegtran and another worker to S3?
Thanks for the help
Your worker could start the next process.
class ImagemagickWorker
{
public function imagemagicProcessing (GearmanJob $job)
{
// your image processing code
$gmClient = new GearmanClient();
$gmClient->do('jpegtranProcessing', $workload);
}
}
Case you need more complex control over processing consider using tasks and defining callbacks.
class ImagemagickTask
{
public function imagemagicProcessing ($workload)
{
// do whatever you need to do
$gmClient = new GearmanClient();
$gmClient->setCompleteCallback (
function (GearmanTask $task) use ($gmClient)
{
// repeat the process
}
);
$gmClient->addTask('imagemagicProcessing', $workload);
$gmClient->runTasks();
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.