コード例 #1
0
ファイル: thumbnailer.php プロジェクト: bitweaver/fisheye
$processContent = array();
while (!$rs->EOF) {
    $processContent[$rs->fields['content_id']] = $rs->fields;
    $processContent[$rs->fields['content_id']]['parameters'] = unserialize($rs->fields['processor_parameters']);
    $sql2 = "UPDATE `" . BIT_DB_PREFIX . "liberty_process_queue` SET `begin_date`=? WHERE `content_id`=?";
    $rs2 = $gBitSystem->mDb->query($sql2, array(date('U'), $rs->fields['content_id']));
    $rs->MoveNext();
}
$gBitDb->CompleteTrans();
$log = array();
$total = date('U');
foreach (array_keys($processContent) as $contentId) {
    $image = new FisheyeImage(NULL, $contentId);
    $begin = date('U');
    if (!empty($processContent[$contentId]['parameters']['resize_original'])) {
        $image->resizeOriginal($processContent[$contentId]['parameters']['resize_original']);
    }
    if ($image->renderThumbnails()) {
        $log[$contentId]['message'] = 'SUCCESS: Thumbnails created';
        $sql3 = "UPDATE `" . BIT_DB_PREFIX . "liberty_process_queue` SET `begin_date`=?, `end_date`=? WHERE `content_id`=?";
        $rs3 = $gBitSystem->mDb->query($sql3, array($begin, $gBitSystem->getUTCTime(), $contentId));
    } else {
        $log[$contentId]['message'] = ' ERROR: ' . $image->mErrors['thumbnail'];
    }
    $log[$contentId]['time'] = date('d/M/Y:H:i:s O');
    $log[$contentId]['duration'] = date('U') - $begin;
    $log[$contentId]['delay'] = date('U') - $total;
}
foreach (array_keys($log) as $contentId) {
    // generate something that kinda looks like apache common log format
    print $contentId . ' - - [' . $log[$contentId]['time'] . '] "' . $log[$contentId]['message'] . '" ' . $log[$contentId]['duration'] . "seconds <br/>\n";