/** * Processes the POST request, generating a ThumberResponse, validating, and passing the result to $callback. * If not using client.php as the webhook, whoever receives webhook response should first invoke this method to * validate response. */ public function receiveThumbResponse() { $resp = parent::receiveThumbResponse(); if (is_null($resp)) { return; } $nonce = $resp->getNonce(); $split = explode(DG_ThumberCoThumber::NonceSeparator, $nonce); if ($resp->getSuccess() && count($split) === 2) { $ID = absint($split[0]); $tmpfile = DG_Util::getTempFile(); file_put_contents($tmpfile, $resp->getDecodedData()); DG_Thumber::setThumbnail($ID, $tmpfile, array(__CLASS__, 'getThumberThumbnail')); DG_Logger::writeLog(DG_LogLevel::Detail, "Received thumbnail from Thumber for attachment #{$split[0]}."); } else { $ID = count($split) > 0 ? $split[0] : $nonce; DG_Logger::writeLog(DG_LogLevel::Warning, "Thumber was unable to process attachment #{$ID}: " . $resp->getError()); } }