Пример #1
0
if (DEBUG) {
    $fd = fopen('debug.txt', 'a');
    fwrite($fd, print_r($_POST, true));
    fwrite($fd, print_r($_FILES, true));
    fwrite($fd, print_r($debug_msgs, true));
    fclose($fd);
}
$response = new response();
switch ($cmd) {
    case 'login':
        login($_POST['uname'], $_POST['password']);
        break;
    case 'fetch-albums':
        list_albums();
        break;
    case 'fetch-album-images':
        list_images($_POST['set_albumName']);
        break;
    case 'add-item':
        add_image($_POST['set_albumName'], $_FILES['userfile']['name'], $_POST['caption']);
        break;
    case 'new-album':
        // There is a title field as well, but since Plogger doesn't use it, we drop it
        gr_add_album($_POST['set_albumName'], $_POST['newAlbumTitle'], $_POST['newAlbumDesc']);
        break;
    default:
        $response->set_key('status', GR_STAT_UNKNOWN_CMD);
        $response->set_key('status_text', 'Unknown command.');
}
$response->write();
close_db();
Пример #2
0
    return $files;
}
$DIR = @$_GET['dir'] ? safedir($_GET['dir']) : 'images';
$IMG = @$_GET['img'] ? $_GET['img'] : list_images($DIR, 0);
$old = new Img($IMG);
?>

<h1>imgmin: lossless + intelligent lossy JPEG compression</h1>

<div style="display:table">
<div class="r">

<?php 
$classify = array(array('Small', 200, array()), array('Medium', 400, array()), array('Large', INF, array()));
# partition images
$li = list_images($DIR);
asort($li);
foreach ($li as $img) {
    list($width, $height, $type, $attr) = getimagesize($img);
    for ($i = 0; $i < count($classify); $i++) {
        if (max($width, $height) < $classify[$i][1]) {
            $classify[$i][2][] = $img;
            break;
        }
    }
}
$id = 0;
foreach ($classify as $c) {
    list($title, $size, $images) = $c;
    if ($images) {
        ?>
Пример #3
0
$cmd = isset($_POST["cmd"]) ? $_POST["cmd"] : "";
if (DEBUG) {
    $fd = fopen("debug.txt", "a");
    fwrite($fd, print_r($_POST, true));
    fwrite($fd, print_r($_FILES, true));
    fwrite($fd, print_r($debug_msgs, true));
    fclose($fd);
}
$response = new response();
switch ($cmd) {
    case "login":
        login($_POST["uname"], $_POST["password"]);
        break;
    case "fetch-albums":
        list_albums();
        break;
    case "fetch-album-images":
        list_images($_POST["set_albumName"]);
        break;
    case "add-item":
        add_image($_POST["set_albumName"], $_FILES["userfile"]["name"], $_POST["caption"]);
        break;
    case "new-album":
        // there is a title field as well, but since plogger doesn't use it, we drop it
        gr_add_album($_POST["set_albumName"], $_POST["newAlbumTitle"], $_POST["newAlbumDesc"]);
        break;
    default:
        $response->set_key("status", GR_STAT_UNKNOWN_CMD);
        $response->set_key("status_text", "Unknown command.");
}
$response->write();
Пример #4
0
function is_image_uptodate($item)
{
    if (!($time = get_oldest_image_time($item['name']))) {
        return false;
    }
    if ($item['inventory_image']) {
        foreach (list_images($item['inventory_image']) as $file) {
            if (is_mt_file_newer($file, $time)) {
                return false;
            }
        }
    }
    if ($item['tiles']) {
        foreach (list_images($item['tiles']) as $file) {
            if (is_mt_file_newer($file, $time)) {
                return false;
            }
        }
    }
    return true;
}
Пример #5
0
    $zipfile = $projectid . "_" . $zip_type . ".zip";
    header('Content-type: application/zip');
    header('Content-Disposition: attachment; filename="' . $zipfile . '"');
    header("Cache-Control: no-cache, must-revalidate");
    header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
    passthru("cat {$list_name} |zip -@ -");
    unlink($list_name);
    exit;
} else {
    echo "<table border='1'>\n";
    echo "<tr>\n";
    echo "<td valign='top'>\n";
    list_images($project, $page_image_names, $existing_image_names, TRUE);
    echo "</td>\n";
    echo "<td valign='top'>\n";
    list_images($project, $nonpage_image_names, $existing_image_names, FALSE);
    echo "</td>\n";
    echo "</tr>\n";
    echo "<tr>\n";
    echo "<td align='center'>\n";
    show_dl_link($projectid, $page_image_names, TRUE);
    echo "</td>\n";
    echo "<td align='center'>\n";
    show_dl_link($projectid, $nonpage_image_names, FALSE);
    echo "</td>\n";
    echo "</tr>\n";
    echo "</table>\n";
}
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
function list_images($project, $image_names, $existing_image_names, $these_are_page_images)
{