public function __construct($modelId) { parent::__construct(); if (!Models\Photo::photoExists(intval($modelId))) { header("HTTP/1.0 404 Not Found"); throw new \Exception('Photo #' . intval($modelId) . ' not found.'); } $this->model = Models\Photo::getPhotoWithID($modelId); $this->title = $this->model->get('description'); $this->icon = 'photo'; $this->url = self::getUrlForID($this->model->id); //todo: done by parent? $this->imageType = 'image/jpeg'; $this->image = $this->model->getMediaURL('thumbnail'); $this->imageType = 'image/jpeg'; $this->imageWidth = $this->model->get('tn_width'); $this->imageHeight = $this->model->get('tn_height'); }