Ejemplo n.º 1
0
 public function thumbImg($id)
 {
     if (!($d = $this->_model->imageData($id))) {
         PPHP::PExit();
     }
     $tmpDir = new PDataDir('gallery/user' . $d->user_id_foreign);
     if (isset($_GET['t'])) {
         $thumbFile = 'thumb' . (int) $_GET['t'] . $d->file;
     } else {
         $thumbFile = 'thumb' . $d->file;
     }
     if (!$tmpDir->fileExists($thumbFile)) {
         $thumbFile = $d->file;
     }
     if (!$tmpDir->fileExists($thumbFile) || $tmpDir->file_Size($thumbFile) == 0) {
         $tmpDir = new PDataDir('gallery');
         $thumbFile = 'nopic.gif';
         $d->mimetype = 'image/gif';
     }
     header('Content-type: ' . $d->mimetype);
     $tmpDir->readFile($thumbFile);
     PPHP::PExit();
 }
Ejemplo n.º 2
0
 /**
  * sends headers, reads out an image and then exits
  *
  * @param int $id - id of group to get thumbnail for
  * @access public
  */
 public function realImg($id)
 {
     if (!($group = $this->createEntity('Group')->findById($id)) || !$group->Picture) {
         PPHP::PExit();
     }
     $dir = new PDataDir('groups');
     if (!$dir->fileExists($group->Picture) || $dir->file_Size($group->Picture) == 0) {
         PPHP::PExit();
     }
     $img = new MOD_images_Image($dir->dirName() . '/' . $group->Picture);
     header('Content-type: ' . $img->getMimetype());
     $dir->readFile($group->Picture);
     PPHP::PExit();
 }