예제 #1
0
파일: page_day.php 프로젝트: jacadym/rawman
function _rm_page_day($page)
{
    $year = substr($page, 0, 2);
    $month = substr($page, 2, 2);
    $ereg = $page . '_[0-9]{5}\\.';
    $raws = array();
    foreach (rmconf('rawdir') as $udir => $dir) {
        if (!is_dir($dir)) {
            continue;
        }
        $raws[$udir] = rawman_readdir(sprintf('%s20%02d_%02d/', $dir, $year, $month), $ereg);
    }
    echo rawman_html('day', array('skins' => RM_WEB . '/skins', 'imgdir' => RM_WEB . '/index.php/image', 'thumbs' => rawman_listday($raws)));
}
예제 #2
0
function _rm_page_month($page)
{
    $arr_month = array('01' => 'Styczeń', '02' => 'Luty', '03' => 'Marzec', '04' => 'Kwiecień', '05' => 'Maj', '06' => 'Czerwiec', '07' => 'Lipiec', '08' => 'Sierpień', '09' => 'Wrzesień', '10' => 'Październik', '11' => 'Listopad', '12' => 'Grudzień');
    $year = substr($page, 0, 2);
    $month = substr($page, 2, 2);
    $ereg = '[0-9]{6}_[0-9]{5}\\.';
    $raws = array();
    foreach (rmconf('rawdir') as $udir => $dir) {
        if (!is_dir($dir)) {
            continue;
        }
        $raws = array_merge($raws, rawman_readdir(sprintf('%s20%02d_%02d/', $dir, $year, $month), $ereg));
    }
    echo rawman_html('month', array('skins' => RM_WEB . '/skins', 'imgdir' => RM_WEB . '/index.php/image', 'content' => rawman_listmonth($raws), 'header' => $arr_month[$month] . ' 20' . $year, 'footer' => RetIf(!IsEmpty($_SESSION['bookmark']), sprintf('&raquo; <a href="' . RM_WEB . '/index.php/bookmark/all">%s</a> (%d) &laquo; ', 'Wyświetl ulubione', count($_SESSION['bookmark'])))));
}
예제 #3
0
function _rm_page_main()
{
    $content = '';
    $months = array();
    foreach (rmconf('rawdir') as $udir => $dir) {
        if (!is_dir($dir)) {
            continue;
        }
        $months = array_merge($months, rawman_readdir($dir, '[0-9]{4}_[0-9]{2}'));
    }
    sort($months);
    $years = array();
    foreach ($months as $month) {
        if (preg_match('/\\d{2}(\\d{2})_(\\d{2})/', $month, $m)) {
            $years[$m[1]][] = $m[2];
        }
    }
    $content = '<table border="0">';
    foreach ($years as $year => $yd) {
        $content .= '<tr><td colspan="4" class="year">20' . $year . "</td></tr>\n";
        for ($m = 1; $m <= 12; $m++) {
            if ($m % 3 == 1) {
                $content .= '<tr><td width="50"></td>';
            }
            $content .= '<td>';
            $month = sprintf('%02d', $m);
            if (in_array($month, $yd)) {
                $link = sprintf('%02d%02d', $year, $month);
                $content .= '<div>' . '<a href="' . RM_WEB . '/index.php/month/all/' . $link . '"> ' . '<img src="' . RM_WEB . '/index.php/stack/all/' . $link . '" border="0" />' . '<br clear="all" />' . $month . '</a>' . "</div>\n";
            }
            $content .= '</td>';
            if ($m % 3 == 0) {
                $content .= "</tr>\n";
            }
        }
    }
    $content .= '</table>';
    echo rawman_html('main', array('skins' => RM_WEB . '/skins', 'content' => $content, 'footer' => RetIf(!IsEmpty($_SESSION['bookmark']), sprintf('&raquo; <a href="' . RM_WEB . '/index.php/bookmark/all">%s</a> (%d) &laquo; ', 'Wyświetl ulubione', count($_SESSION['bookmark'])))));
}
예제 #4
0
function _rm_page_stack($page)
{
    $pagedir = rawman_getpicdir($page);
    $stackdir = rawman_mkdir(array($pagedir, 'stack'));
    if (strlen($page) == 4) {
        // Month
        $ereg = '[0-9]{6}_[0-9]{5}';
    } else {
        // Day
        $ereg = $page . '_[0-9]{5}';
    }
    $items = rawman_readdir($stackdir, $ereg . '.png', true);
    if (count($items)) {
        // Exists
        $stackfile = $items[rand(0, count($items) - 1)];
    } else {
        // Create stack file
        $year = substr($page, 0, 2);
        $month = substr($page, 2, 2);
        $raws = array();
        foreach (rmconf('rawdir') as $udir => $dir) {
            if (!is_dir($dir)) {
                continue;
            }
            $raws = array_merge($raws, rawman_readdir(sprintf('%s20%02d_%02d/', $dir, $year, $month), $ereg, true));
        }
        if (count($raws)) {
            // Random
            $paramdir = rawman_mkdir(array($pagedir, 'param'));
            $rawfile = $raws[rand(0, count($raws) - 1)];
            $filename = rawman_filename($rawfile);
            $stackfile = $stackdir . $filename . '.png';
            rawman_createstack($rawfile, $stackfile, rawman_convparams($paramdir . $filename . '.txt'));
        }
    }
    rawman_showpicture($stackfile);
}
예제 #5
0
function rawman_editbox($pic)
{
    // Reading params and settting form fields
    $par = rawman_mkdir(array(rawman_getpicdir($pic), 'param')) . $pic . '.txt';
    $opt = rawman_convparams($par, array('rating' => 0, 'coloring' => 'none', 'wb' => 'camera', 'rotate' => 'none'));
    if (preg_match('/\\-b\\s+(\\d\\.\\d+)\\b/', $opt['dcraw'], $m)) {
        _fsine(array('brightness' => $m[1]));
    }
    if (IsEmpty($opt['wb']) && preg_match('/\\-a\\b/', $opt['dcraw'], $m)) {
        $opt['wb'] = 'auto';
    }
    if (preg_match('/\\-gamma\\s+(\\d\\.\\d+)\\b/', $opt['cnvpre'], $m)) {
        _fsine(array('gamma' => $m[1]));
    }
    if (preg_match('/\\-t\\s+(\\d+)\\b/', $opt['dcraw'], $m)) {
        $opt['rotate'] = $m[1] == 270 ? 'left' : 'right';
    } elseif (preg_match('/\\-rotate\\s+(\\d+)\\b/', $opt['cnvpre'], $m)) {
        $opt['rotate'] = $m[1] == 270 ? 'left' : 'right';
    }
    $arr_ev = array('-2.00', '-1.66', '-1.50', '-1.33', '-1.00', '-0.66', '-0.50', '-0.33', '0.00', '+0.33', '+0.50', '+0.66', '+1.00', '+1.33', '+1.50', '+1.66', '+2.00');
    $arr_high = array(0 => '0 - White', 1 => '1 - Pink', 3 => '3', 4 => '4', 5 => '5', 6 => '6', 7 => '7', 8 => '8', 9 => '9');
    _fsine(array('ev' => '+0.33', 'rotate' => $opt['rotate']));
    echo '
<form name="editForm">' . CreateHiddenField('balance', $opt['wb']) . rawman_wb($opt['wb'], true) . '<p style="clear:both;"></p>
<ul>
<li>Ekspozycja: ' . CreateSelectField('ev', $arr_ev, 0) . 'EV</li>
<li>Jasność: ' . CreateInputText('brightness', 5) . '</li>
<li>Gamma: ' . CreateInputText('gamma', 5) . '</li>
<li>Ziarno: ' . CreateInputText('noise', 5) . '</li>
<li>Odbłyski: ' . CreateSelectField('highlight', $arr_high) . '</li>
</ul>
' . '<p style="clear:both;"></p>' . CreateHiddenField('rotate', $opt['rotate']) . rawman_rotate($opt['rotate'], true) . '<p style="clear:both;"></p>' . CreateButton('preview', 'View', 'onclick="editImg()"') . CreateButton('cancel', 'Cancel', 'onclick="rmSendReq(\'' . rmconf('elem-dir') . '/info\')"') . CreateButton('apply', 'Apply', 'onclick="applyImg()"') . '</form>';
}
예제 #6
0
<?php

/*
** Sample config file
*/
rmconf('rawdir', array('nef1' => '/opt/raw/NikonD70/', 'net2' => '/opt/raw/NikonD300/'));
// Outputs
rmconf('picdir', '/opt/pic/');
define('RM_WEB', 'http://' . $_SERVER['HTTP_HOST'] . '/rawman');
define('RM_TEM', dirname(dirname(__FILE__)) . '/skins/');
// Binary programs
define('bin_dcraw', '/usr/bin/dcraw');
define('bin_convert', '/usr/bin/convert');
define('bin_exif', '/usr/bin/exiftool');
// Annotate text
define('IMAGE_ANN', " # @@number@@  -  @@year@@  ©   <username> ");
define('THUMB_ANN', " # @@number@@ ");
define('IMAGE_SIZE', '1024x800');
define('opt_dcraw', '-w -h -b 1.33');
define('opt_cnvpre', '-shave 4x4 -gamma 1.15');
define('opt_cnvpost', '-unsharp 3x3+0.3+0');
예제 #7
0
파일: boot.inc.php 프로젝트: jacadym/rawman
function rawman_getpicdir($pic)
{
    return sprintf('%s20%02d_%02d', rmconf('picdir'), substr($pic, 0, 2), substr($pic, 2, 2));
}
예제 #8
0
파일: index.php 프로젝트: jacadym/rawman
/*
** RawManager v. 0.1.0
*/
include './includes/boot.inc.php';
/*
  Photos:
    YYYY_MM/SIZE/yymmdd_nnnnn.jpg
  Icons:
    YYYY_MM/thumb/yymmdd_nnnnn.png
  Stock:
    YYYY_MM/stock/yymmdd_nnnnn.png
  Po wejściu na stronę główną następuje wyświetlenie listy dostępnych katalogów wraz z ikonami stosu
  dla każdego miesiąca. Brany jest pod uwagę pierwsza ikona, która znajduje się w odpowiednim katalogu.
  Jeżeli nie ma ikony to przeszukiwany jest katalog w poszukiwaniu dowolnego rawpliku i utworzenie
  z niego ikon stosu.
  
  Po wybraniu dowolnego katalogu następuje wyświetlenie jego zawartości.
*/
session_start();
// what/udir/item
$pars = rawman_pathinfo();
$what = array_shift($pars);
$udir = array_shift($pars);
$item = array_shift($pars);
$func = '_rm_page_' . $what;
if (empty($what) || !function_exists($func)) {
    $func = '_rm_page_main';
}
rmconf('elem-dir', $udir);
rmconf('elem-id', $item);
$func($item, $pars);