</div> <div class="bd"> <ul class="lists"> <?php foreach ($recommend as $key => $item) { ?> <li> <a class="photo" href="/<?php echo $item['id']; ?> .html" target="photo"> <img src="<?php echo URL::domain() . Str::changeLoad($thumb->create($item['img_dir'] . '/' . $item['picname'], 130, 130)); ?> " /> </a> <span class="info"> <a class="photo_id" href="/<?php echo $item['id']; ?> .html" title="<?php echo $item['custom_name']; ?> "target="photo"><?php echo Str::slice($item['custom_name'], 15, '...'); ?> </a><br /> 会员:<?php
/** * 图片集合 */ public function action_zoom() { $this->template->pid = $pid = (int) $this->getQuery('id'); $this->template->zoom = $zoom = trim($this->getQuery('zoom')); $this->template->info = $info = ORM::factory('img')->select('imgs.*', 'u.username', 'd.disk_domain')->join(array('users', 'u'))->on('u.uid', '=', 'imgs.userid')->join(array('img_disks', 'd'))->on('d.disk_domain', '=', 'imgs.disk_id')->where('imgs.id', '=', (int) $pid)->find(); if (empty($info->picname)) { $this->show_message('非法访问', 0, array(), true); } $url = URL::domain(); $picname = $info->disk_name . '/' . $info->picname; $imRule = Str::changeLoad($picname, true); if ($zoom == 'medium') { $picname = $this->thumb->create($picname, 640, 640, 's'); $imRule = Str::changeLoad($picname); } elseif ($zoom == 'thumb') { $picname = $this->thumb->create($picname, 130, 130); $imRule = Str::changeLoad($picname); } $this->template->picinfo = $picinfo = @getimagesize($picname); $this->template->picname = $url . $imRule; }
<ul class="back"> <li><a href="/">返回首页</a></li> </ul> </div> <div class="bd"> <ul class="lists"> <?php foreach ($pagination as $k => $img) { ?> <li style="height:200px;"> <a class="photo" href="/<?php echo $img['id']; ?> .html" target="photo" style="height:130px; width:130px;"> <img src="<?php echo URL::domain() . Str::changeLoad($thumb->create($img['disk_name'] . '/' . $img['picname'], 130, 130)); ?> " /> </a> <span class="info"> <a class="photo_id" href="/<?php echo $img['id']; ?> .html" title='查看图片详情'><?php echo Str::slice($img['custom_name'], 15, '...'); ?> </a><br /> <strong> 浏览<?php echo $img['click']; ?> 次</strong> </span> </li>
?> </h2> <div class="clearfloat"></div> <span class="upload_time" style="float:left;">上传用户:【<?php echo $imgInfo['username']; ?> 】 上传于<?php echo date('Y-m-d', $imgInfo['uploadtime']); ?> </span><span class="back"><a href="javascript:" onclick="report(this);">举报</a><a href="/">返回首页</a> </span> </div> <div class="clearfloat"></div> <div style="border-bottom:4px solid #85C64E;"></div> <div class="pic"> <br /> <img src="<?php echo URL::domain() . Str::changeLoad($thumb->create($imgInfo['img_dir'] . '/' . $imgInfo['picname'], 640, 640, 's')); ?> " alt="<?php echo $imgInfo['custom_name']; ?> "/><br /> <br /> <a class="img" href="/pic/zoom?id=<?php echo $imgInfo['id']; ?> ">查看原图 </a> </div> </div> <div class="comment"> <div class="title"> <h2>留言评论</h2> <sub>+Message comment</sub> </div>
/** * 添加专题 * */ public function action_add() { $this->checklogin(); $this->template->pageTitle = '添加专题'; $this->_add_css('styles/album/add_topics.css'); $this->_add_script('scripts/copy.js'); $specialpic = ORM::factory('specialpic'); if ($this->isPost()) { $post = Validate::factory($this->getPost())->filter(TRUE, 'trim')->rule('title', 'not_empty')->rule('content', 'not_empty'); if ($post->check()) { $specialpic->values($post); $specialpic->uid = $this->auth['uid']; $specialpic->save(); $specialpic->sid; // 添加专题标签 $tag = new Tags(); $tags = trim($this->getPost('tags')); $tags = explode(' ', $tags); $tag->add($specialpic->sid, 'img_subject', $tags, $this->auth['uid']); $links[] = array('text' => '返回专题列表', 'href' => '/picsubject/list'); $this->show_message('发现专题图片操作成功。', 1, $links, true); } else { // 校验失败,获得错误提示 $str = ''; $this->template->registerErr = $errors = $post->errors('default/pic/pic'); foreach ($errors as $item) { $str .= $item . '<br>'; } $this->show_message($str); } } $pid = $this->getQuery('id'); $arr = explode('-', $pid); $select = DB::select('imgs.picname', 'imgs.userid', 'imgs.custom_name', 'd.disk_domain', 'd.disk_name', array('imgs.disk_name', 'img_dir'))->from('imgs')->join(array('img_disks', 'd'))->on('d.disk_domain', '=', 'imgs.disk_id')->where('imgs.id', 'in', $arr)->where('imgs.userid', '=', $this->auth['uid']); $rows = $select->execute()->as_array(); $str = ''; foreach ($rows as $item) { $temp_img = $item['img_dir'] . '/' . $item['picname']; list($width, $height) = getimagesize($temp_img); if ($width >= 640) { $temp_img = $this->thumb->create($temp_img, 640, 640, 's'); $temp_img = Str::changeLoad($temp_img, false); } else { $temp_img = Str::changeLoad($temp_img, true); } $str .= '<p>' . "<img src=\"" . URL::domain() . $temp_img . '" alt="' . $item['custom_name'] . '"/></p><p style="text-align:center;">' . $item['custom_name'] . '</p>'; } $this->template->content = $str; }