protected function buildDimensions(SwatDetailsView $view)
 {
     $dimensions = $this->getSelectableDimensions();
     if (count($dimensions) <= 1) {
         $view->getField('dimensions')->visible = false;
         return;
     }
     $list = array();
     foreach ($dimensions as $dimension) {
         ob_start();
         if ($dimension->id == $this->dimension->id) {
             $span_tag = new SwatHtmlTag('span');
             $span_tag->setContent($dimension->title);
             $span_tag->display();
         } else {
             $a_tag = new SwatHtmlTag('a');
             if ($dimension->shortname == 'original') {
                 $a_tag->href = $this->photo->getUri('original');
             } else {
                 $a_tag->href = $this->app->config->pinhole->path . 'photo/' . $this->photo->id . '/' . $dimension->shortname;
             }
             if (count($this->tag_list) > 0) {
                 $a_tag->href .= '?' . $this->tag_list->__toString();
             }
             $a_tag->setContent($dimension->title);
             $a_tag->display();
             if ($dimension->shortname == 'original') {
                 printf(' (%d × %d pixels)', $this->photo->getWidth($dimension->shortname), $this->photo->getHeight($dimension->shortname));
             }
         }
         $list[] = ob_get_clean();
     }
     $view->getField('dimensions')->getFirstRenderer()->text = implode(', ', $list);
 }
Example #2
0
 protected function buildSiteLinks()
 {
     $replicator = $this->ui->getWidget('site_link_field');
     foreach ($this->getDimensions() as $dimension) {
         if ($dimension->shortname == 'original') {
             $image = $this->photo->getTitle(true);
             $link = $this->photo->getUri('original');
         } else {
             $image = $this->photo->getImgTag($dimension->shortname);
             $image->src = $this->app->getFrontendBaseHref() . $image->src;
             $link = 'photo/' . $this->photo->id;
         }
         $code = sprintf('<a href="%s%s">%s</a>', $this->app->getFrontendBaseHref(), $link, $image);
         $replicator->getWidget('site_link_code', $dimension->id)->value = $code;
     }
 }
Example #3
0
 protected function getResponse(PinholePhoto $photo)
 {
     $response = array();
     if ($photo->status === PinholePhoto::STATUS_PROCESSING_ERROR) {
         $response['status'] = 'error';
         $response['error_message'] = sprintf(Pinhole::_('Error processing file %s'), $photo->original_filename);
     } elseif ($photo->isProcessed()) {
         $response['status'] = 'processed';
         $response['auto_publish'] = $photo->auto_publish;
         $response['image_uri'] = $photo->getUri('thumb');
         $response['new_tags'] = $this->getNewTags($photo);
         $response['tile'] = $this->getTile($photo);
     } else {
         $response['status'] = 'unknown';
     }
     return $response;
 }
 protected function displayNext(PinholePhoto $photo = null)
 {
     if ($photo === null) {
         $span_tag = new SwatHtmlTag('span');
         $span_tag->class = 'next';
         $span_tag->setContent(Pinhole::_('Next'));
         $span_tag->display();
     } else {
         $a_tag = new SwatHtmlTag('a');
         $href = $this->appendTagPath(sprintf('%sphoto/%s', $this->base, $photo->id));
         $a_tag->href = $href;
         $a_tag->title = $photo->title;
         $a_tag->class = 'next';
         $a_tag->setContent(Pinhole::_('Next'));
         $a_tag->display();
         $this->html_head_entry_set->addEntry(new SwatLinkHtmlHeadEntry($href, 'prefetch', null, null, Pinhole::PACKAGE_ID));
         $this->html_head_entry_set->addEntry(new SwatLinkHtmlHeadEntry($photo->getUri('large'), 'prefetch', null, null, Pinhole::PACKAGE_ID));
         $this->html_head_entry_set->addEntry(new SwatLinkHtmlHeadEntry($href, 'next', null, $photo->title, Pinhole::PACKAGE_ID));
     }
 }