Exemplo n.º 1
0
 private function show_image($pid, $type, $is_animate = FALSE)
 {
     $this->set_browsercache();
     if ($type > 0) {
         //如果是缩略图
         /*
         $client= new GearmanClient();
         $client->addServers(Core::config('job_servers'));
         $client->setTimeout(3000);
         $result = @ $client->doHigh("thumbnail", serialize(array($pid, $type)));
         $result && $sid = @ unserialize($result);
         */
         if ($sid) {
             $source = new Models\PhotoSource();
             $source->findOne($sid);
             $source->output();
             //异步缩略图
         } else {
             $thumb = new Thumb();
             if ($thumb->resize(NULL, $pid, $type, $is_animate)) {
                 $thumb->output();
                 //同步缩略图
             }
         }
     } else {
         $photoModel = new Models\Photo();
         $photoModel->findOne($pid);
         $photosource = $photoModel->getSource();
         if ($photosource) {
             $photosource->output();
         }
     }
 }