示例#1
0
文件: utils.php 项目: aag/dinoremix
function getRandomImageForPos($panelsDir, $pos)
{
    $fullPosName = posAbbrToFull($pos);
    $filename = "";
    $fileListDir = "filelists/";
    if ($fullPosName != "") {
        $serializedPaths = file_get_contents($fileListDir . $fullPosName . "Paths.txt");
        $allFiles = unserialize($serializedPaths);
        $filename = getRandomString($allFiles);
    }
    return $filename;
}
示例#2
0
 * Copyright 2008, 2009 Adam Goforth
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>. 
 */
if (!isset($_REQUEST["pos"])) {
    die;
}
include "utils.php";
$panelsDir = "panels/";
$posList = split("-", $_REQUEST["pos"]);
$imgDescList = array();
foreach ($posList as $pos) {
    $posdir = posAbbrToFull($pos);
    if ($posdir != "") {
        $imgFileName = getRandomImageForPos($panelsDir, $pos);
        $imgDesc = array("pos" => $pos, "file" => $imgFileName);
        $imgDescList[] = $imgDesc;
    }
}
print json_encode($imgDescList);
示例#3
0
文件: index.php 项目: aag/dinoremix
 */
$IN_DINOREMIX = true;
require_once "utils.php";
$panelsDir = "panels/";
// Get permutation information
$comicsfiles = removeDots(scandir("panels/topleft"));
$numComics = sizeof($comicsfiles);
$numPerms = number_format(pow($numComics, 6) + pow($numComics, 3) + pow($numComics, 2));
$lockClasses = array();
$imgFileNames = array();
$posAbbrs = array(0 => "tl", "tm", "tr", "bl", "bm", "br");
$posNums = array();
$altText = "";
// Check each panel to see if it's locked
foreach ($posAbbrs as $key => $pos) {
    $fullName = posAbbrToFull($pos);
    if (isset($_GET[$pos])) {
        // Panel is locked
        $imgFileNames[$pos] = "comic2-" . $_GET[$pos] . "-" . $fullName . ".png";
        $lockClasses[$pos] = "locked";
        $posNums[$pos] = $_GET[$pos];
    } else {
        // Panel is unlocked
        $imgFileNames[$pos] = getRandomImageForPos($panelsDir, $pos);
        $lockClasses[$pos] = "unlocked";
        $posNums[$pos] = getComicNumFromImageURL($imgFileNames[$pos]);
    }
}
// Get the alt text for the panels
if (isset($_GET['alt'])) {
    $altText = stripslashes($_GET['alt']);