コード例 #1
0
ファイル: thumbs_fix.php プロジェクト: xfirespeed/TyP-Gallery
            if ($ext == "png") {
                return true;
            } else {
                if ($ext == "bmp") {
                    return true;
                } else {
                    return false;
                }
            }
        }
    }
}
$dir_contents = scandir($dir);
foreach ($dir_contents as $item) {
    if (is_dir($dir . $item) && $item != '.' && $item != '..') {
        $dirs[] = $item;
    }
}
foreach ($dirs as $current) {
    $dir_contents = scandir("./images/" . $current . "/");
    foreach ($dir_contents as $item) {
        if ($item != '.' && $item != '..' && !is_dir($dir . $item) && is_valid_extension($item) && !file_exists("./thumbnails/{$current}/thumbnail_{$item}")) {
            $image = new image();
            if (!is_dir("./thumbnails/" . $current . "/")) {
                $image->makethumbnailfolder($current);
            }
            $image->thumbnail($current . "/" . $item);
            print "./thumbnails/" . $current . "/thumbnail_" . $item . "<br>\n";
        }
    }
}
コード例 #2
0
ファイル: post_add.php プロジェクト: xfirespeed/TyP-Gallery
     if ($rating == "q") {
         $rating = "Questionable";
     } else {
         $rating = "Safe";
     }
 }
 if ($userc->check_log()) {
     $user = $checked_username;
 } else {
     $user = "******";
 }
 $ip = $db->real_escape_string($_SERVER['REMOTE_ADDR']);
 $isinfo = getimagesize("./images/" . $iinfo[0] . "/" . $iinfo[1]);
 $query = "INSERT INTO {$post_table}(creation_date, hash, image, title, owner, height, width, ext, rating, tags, directory, source, active_date, ip) VALUES(NOW(), '" . md5_file("./images/" . $iinfo[0] . "/" . $iinfo[1]) . "', '" . $iinfo[1] . "', '{$title}', '{$user}', '" . $isinfo[1] . "', '" . $isinfo[0] . "', '{$ext}', '{$rating}', '{$tags}', '" . $iinfo[0] . "', '{$source}', '" . date("Ymd") . "', '{$ip}')";
 if (!is_dir("./thumbnails/" . $iinfo[0] . "/")) {
     $image->makethumbnailfolder($iinfo[0]);
 }
 if (!$image->thumbnail($iinfo[0] . "/" . $iinfo[1])) {
     print "Thumbnail generation failed! A serious error occured and the image could not be resized.<br /><br />";
 }
 if (!$db->query($query)) {
     print "failed to upload image.";
     print $query;
     unlink("./images/" . $iinfo[0] . "/" . $iinfo[1]);
     $image->folder_index_decrement($iinfo[0]);
     $ttags = explode(" ", $tags);
     foreach ($ttags as $current) {
         $tclass->deleteindextag($current);
     }
 } else {
     $query = "SELECT id, tags FROM {$post_table} WHERE hash='" . md5_file('./images/' . $iinfo[0] . "/" . $iinfo[1]) . "' AND image='" . $iinfo[1] . "' AND directory='" . $iinfo[0] . "'  LIMIT 1";