diff --git a/application/default/controllers/ServiceController.php b/application/default/controllers/ServiceController.php index ea6bca06..b8bc6752 100644 --- a/application/default/controllers/ServiceController.php +++ b/application/default/controllers/ServiceController.php @@ -58,6 +58,38 @@ class ServiceController extends Zend_Controller_Action } /* + * 查看数据缩略大图 + */ + function bigthumbAction() + { + $id = (int)$this->_request->getParam('id'); + if (empty($id)) { + $uuid = $this->_request->getParam('uuid'); + if (empty($uuid)) $this->_redirect('/data'); + $where=$this->db->quoteInto('m.uuid = ?',$uuid); + } else { + $where=$this->db->quoteInto('m.id = ?',$id); + } + $sql="select g.id as gid,t.filename,t.filetype from geonetworkmetadata g left join metadata m on g.uuid=m.uuid left join thumbnail t on t.id=m.id where ".$where; + $thumb=$this->db->fetchRow($sql); + $this->_helper->layout->disableLayout(); + $this->_helper->viewRenderer->setNoRender(); + if (empty($thumb['filename'])) { + header("Content-Type:image/png"); + header("Content-Length: " . filesize("images/nothumb.png")); + $file=fopen("images/nothumb.png",'r'); + fpassthru($file); + exit; + } else { + $url=$this->view->config->bigthumb->path.sprintf('%05d',floor(($thumb['gid']+0.1)/100)*100).'-'.sprintf('%05d',ceil(($thumb['gid']+0.1)/100)*100-1)."/".$thumb['gid']; + $url.='/public/'.str_replace('_s.','.',$thumb['filename']); + header("Content-Type:image/".$thumb['filetype']); + $file=fopen($url,'r'); + fpassthru($file); + exit; + } + } + /* * 搜索, no page, json output */ function searchAction()