function processImageTask(Request $request, $imageFunction, ImagickTaskQueue $taskQueue, $category, $example) { //use ($params) $debug = 'Unknown state'; $job = $request->getVariable('job', false); if ($job === false) { if ($taskQueue->isActive() == false) { //Queue isn't active - don't bother queueing a task return null; } $task = \ImagickDemo\Queue\ImagickTask::create($category, $example, $imageFunction, $params); $debug .= "task created."; $taskQueue->addTask($task); } if ($request->getVariable('noredirect') == true) { return new \ImagickDemo\Response\ErrorResponse(503, "image still processing {$job} is " . $job . $debug); } return redirectWaitingTask($request, intval($job)); }
function originalImage(\Intahwebz\Request $request, \Auryn\Injector $injector) { \ImagickDemo\Imagick\functions::load(); $original = $request->getVariable('original', false); if ($original) { //TODO - these are not cached. //TODO - Bug waiting for pull https://github.com/rdlowrey/Auryn/pull/104 //means we can't execute directly. //return $injector->execute(['ImagickDemo\Example', 'renderOriginalImage']); $instance = $injector->make('ImagickDemo\\Example'); return $injector->execute([$instance, 'renderOriginalImage']); } return null; }
function originalImage(\Intahwebz\Request $request, \Auryn\Injector $injector) { \ImagickDemo\Imagick\functions::load(); $original = $request->getVariable('original', false); if ($original) { $instance = $injector->make('ImagickDemo\\Example'); return $injector->execute([$instance, 'renderOriginalImage']); } return null; }
/** * @param \Intahwebz\Request $request * @return callable|null */ function checkGetOriginalImage(\Intahwebz\Request $request) { $original = $request->getVariable('original', false); if ($original) { //TODO - these are not cached. $callable = function (\Auryn\Injector $injector) { return $injector->execute([\ImagickDemo\Example::class, 'renderOriginalImage']); }; return $callable; } return null; }