Пример #1
0
 protected function _loadObject($id)
 {
     $image = new \ATPCms\Model\Image();
     $image->loadByIdentifier($id);
     if (!$image->id) {
         $image->loadById($id);
     }
     return $image;
 }
Пример #2
0
 public function imageAction()
 {
     $this->init();
     $imageUrl = $this->params('id');
     $image = new \ATPCms\Model\Image();
     $image->loadByIdentifier($imageUrl);
     if (!$image->id) {
         $this->getResponse()->setStatusCode(404);
         return;
     }
     $path = $image->filePath('imageFile');
     header("Content-Type: {$image->imageFile->type}");
     echo file_get_contents("public/{$path}");
     die;
 }