Skip to content

Instantly share code, notes, and snippets.

@fabriziomachado
Created November 19, 2011 20:42
Show Gist options
  • Save fabriziomachado/1379330 to your computer and use it in GitHub Desktop.
Save fabriziomachado/1379330 to your computer and use it in GitHub Desktop.
application/workers/resize_image_worker.php
<?php
include_once dirname(__FILE__) . '/worker_helper.php';
$gmw = new GearmanWorker();
$gmw->addServer();
$gmw->addFunction("resize_image", "resize_image");
# waiting for job
while($gmw->work()){
if($gmw->returnCode() != GEARMAN_SUCCESS) break;
}
# function this worker
function resize_image($job)
{
$job_params = unserialize($job->workload());
$resize_job = new ResizeImageJob($job_params);
return GEARMAN_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment