$author = $_SESSION['uid']; $upload = date("Y-m-d H:i"); $update = date("Y-m-d H:i"); $json = get_option('stor'); $stor = json_decode($json); $i = 0; // 2143289344 = 2GB*1024*1024*1024 - 4MB*1024*1024 while ($storage->getDomainCapacity($stor[$i]) > 2143289344) { $i++; } $domain = $stor[$i]; $storage->upload($domain, 'original/' . $name, $_FILES['file']['tmp_name']); if ($storage->errno == 0) { // 生成缩略图 $img_data = $storage->read($domain, 'original/' . $name); $img_info = getimagesize($_FILES['file']['tmp_name']); $width = $img_info[0]; $height = $img_info[1]; add_photo($author, $name, $title, $filesize, $width, $height, $upload, $update, $domain, '1'); $uid = get_photo_info($name, 'uid', 'name'); $url = photo_link($uid); header("Location: {$url}"); exit; } } else { header("refresh:1;url=" . SITE_URL . "upload.php"); echo '你提交的不是图片...'; exit; } } }
$prep = $qpage['prep']; $_GET['page'] == '' ? $paged = 1 : ($paged = $_GET['page']); $offset = ($paged - 1) * $prep; if ($photos = $migs_db->get_results("SELECT * FROM {$migs_db->photos} ORDER BY uid DESC LIMIT {$offset}, {$prep}")) { foreach ($photos as $photo) { ?> <div id="photo-item-<?php echo $photo->uid; ?> " class="photo-item"> <div id="photo-<?php echo $photo->uid; ?> " class="x-photo"> <a class="p-img" href="<?php echo photo_link($photo->uid); ?> "> <img src="<?php echo thumb_url($photo->storage, $photo->name); ?> " alt="<?php echo $photo->title; ?> " width="200" /> </a> </div><!-- #photo-<?php echo $photo->uid; ?> -->