function _rm_page_thumb($pic) { if (preg_match('/(\\d{2})(\\d{2})(\\d{2})_(\\d{5})/', $pic, $m)) { $year = $m[1]; $month = $m[2]; $day = $m[3]; $number = $m[4]; $monthdir = rawman_getpicdir($pic); $thumbdir = rawman_mkdir(array($monthdir, 'thumb')); $paramdir = rawman_mkdir(array($monthdir, 'param')); $thumbfile = $thumbdir . $pic; $opt = array('year' => '20' . $year, 'number' => $number); if (!is_file($thumbfile)) { $filename = rawman_filename($pic); $rawfile = rawman_getrawfile($pic); rawman_createthumb($rawfile, $thumbfile, rawman_convparams($paramdir . $filename . '.txt', $opt)); } rawman_showpicture($thumbfile); } }
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); }
function _rm_page_image($pic, $params) { if (preg_match('/(\\d{2})(\\d{2})(\\d{2})_(\\d{5})/', $pic, $match)) { $year = $match[1]; $month = $match[2]; $day = $match[3]; $number = $match[4]; $monthdir = rawman_getpicdir($pic); $imagedir = rawman_mkdir(array($monthdir, 'image', IMAGE_SIZE)); $paramdir = rawman_mkdir(array($monthdir, 'param')); $imagefile = $imagedir . $pic; $opt = array('year' => '20' . $year, 'number' => $number); if (!is_file($imagefile)) { $filename = rawman_filename($pic); $rawfile = rawman_getrawfile($pic); rawman_createimage($rawfile, $imagefile, rawman_convparams($paramdir . $filename . '.txt', $opt)); } rawman_showpicture($imagefile); } else { $act = $pic; $pic = $params[0]; switch ($act) { case 'info': rawman_infobox($pic); break; case 'box': rawman_editbox($pic); break; case 'edit': $conv = $params[0]; $img = $params[1]; rawman_editimage($conv, $img); break; case 'apply': $conv = $params[0]; $img = $params[1]; rawman_applyimage($conv, $img); rawman_infobox($img); break; case 'add': rawman_bookmark($pic, 'add'); rawman_infobox($pic); break; case 'del': rawman_bookmark($pic, 'del'); rawman_infobox($pic); break; case 'gen': rawman_genimage($pic); rawman_infobox($pic); break; case 'rate': $rate = $params[0]; $pic = $params[1]; rawman_rateimage($pic, $rate); rawman_infobox($pic); break; case 'color': $color = $params[0]; $pic = $params[1]; rawman_colorimage($pic, $color); rawman_infobox($pic); break; } } }