コード例 #1
0
ファイル: index.php プロジェクト: rbeitra/cleangallery
<?php

$time_start = microtime(true);
require_once './lib.php';
$gallery = getRequestInput('gallery', SINGLE_GALLERY, '/^[0-9a-zA-Z_\\040\\/]+$/');
$photo = getRequestInput('photo', '');
$galleryurl = './?gallery=' . rawurlencode($gallery);
$photourl = GALLERIES_DIR . rawurlencode($gallery) . '/' . rawurlencode($photo);
$title = SITE_NAME;
if ($gallery != '') {
    $title .= ' - ' . $gallery;
    if ($photo != '') {
        $title .= ' - ' . $photo;
    }
}
?>
<!DOCTYPE html>
<html lang="en">
<meta charset=utf-8>
<title><?php 
echo $title;
?>
</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>
<body>
<div class="page">
<div class="title"><?php 
echo SITE_NAME;
?>
</div>
コード例 #2
0
ファイル: img.php プロジェクト: rbeitra/cleangallery
<?php

require_once './lib.php';
error_reporting(0);
//this may give an error if it fails. we could suppress it and we will return the generated image anyway!
$gallery = getRequestInput('gallery', '', '/^[0-9a-zA-Z_\\040\\/]+$/');
$photo = getRequestInput('photo', '');
$width = getRequestInput('width', 0, '/^[0-9]+$/');
$height = getRequestInput('height', 0, '/^[0-9]+$/');
$width = min($width, 1024);
$height = min($height, 1024);
$type = getImageHeader(getExtension($photo));
$imgname = $gallery . ':' . $photo . ':' . $width . ':' . $height;
$path = THUMBS_DIR . md5($imgname);
//if(!file_exists(THUMBS_DIR)){
//	mkdir(THUMBS_DIR);
//}
$thumb_exists = file_exists($path);
$create_thumb = !$thumb_exists;
$thumb_generated = FALSE;
$thumb_image = 0;
if ($create_thumb) {
    //try to create the thumb!
    $imageinfo = getGalleryPhoto($gallery, $photo, 0);
    if ($width == 0 && $height == 0) {
        //just use the original!
        $path = $imageinfo['path'];
        $thumb_exists = TRUE;
    } else {
        $image = getImage($imageinfo['path']);
        $iwidth = imagesx($image);