Beispiel #1
0
 /**
  * Render EXIF info.
  *
  * @return  array
  */
 public function exif()
 {
     // Basic info
     $info = array('<span>&copy;</span> ' . __('Copyright') => $this->image->author_id ? HTML::user($this->image->author_id) : null, '<i class="fa fa-fw fa-upload"></i> ' . __('Added') => HTML::time(Date::format('DMYYYY_HM', $this->image->created), $this->image->created), '<i class="fa fa-fw fa-comment"></i> ' . __('Comments') => (int) $this->image->comment_count, '<i class="fa fa-fw fa-eye"></i> ' . __('Views') => (int) $this->image->view_count);
     // EXIF info
     if ($exif = $this->image->exif()) {
         if ($exif->make || $exif->model) {
             $info['<i class="fa fa-fw fa-camera-retro"></i> ' . __('Camera')] = ($exif->make ? HTML::chars($exif->make) : '') . ($exif->model ? ($exif->make ? '<br />' : '') . HTML::chars($exif->model) : '');
         }
         if ($exif->exposure) {
             $info['<i class="fa fa-fw fa-sun-o"></i> ' . __('Shutter Speed')] = HTML::chars($exif->exposure);
         }
         if ($exif->aperture) {
             $info['<i class="fa fa-fw fa-circle-o"></i> ' . __('Aperture')] = HTML::chars($exif->aperture);
         }
         if ($exif->focal) {
             $info['<i class="fa fa-fw fa-road"></i> ' . __('Focal Length')] = HTML::chars($exif->focal);
         }
         if ($exif->iso) {
             $info['<span class="iso fa fa-fw">iso</span> ' . __('ISO Speed')] = HTML::chars($exif->iso);
         }
         if ($exif->lens) {
             $info['<i class="fa fa-fw fa-cd"></i> ' . __('Lens')] = HTML::chars($exif->lens);
         }
         if ($exif->flash) {
             $info['<i class="fa fa-fw fa-bolt"></i> ' . __('Flash')] = HTML::chars($exif->flash);
         }
         if ($exif->program) {
             $info['<i class="fa fa-fw fa-cloud"></i> ' . __('Program')] = HTML::chars($exif->program);
         }
         if ($exif->metering) {
             $info['<i class="fa fa-fw fa-th"></i> ' . __('Metering')] = HTML::chars($exif->metering);
         }
         if ($exif->latitude) {
             $info['<i class="fa fa-fw fa-arrows-h"></i> ' . __('Latitude')] = HTML::chars($exif->latitude);
         }
         if ($exif->longitude) {
             $info['<i class="fa fa-fw fa-arrows-v"></i> ' . __('Longitude')] = HTML::chars($exif->longitude);
         }
         if ($exif->altitude) {
             $info['<i class="fa fa-fw fa-long-arrow-up"></i> ' . __('Altitude')] = HTML::chars($exif->altitude) . 'm';
         }
         if ($exif->taken) {
             $info['<i class="fa fa-fw fa-calendar"></i> ' . __('Taken')] = Date::format('DMYYYY_HM', $exif->taken);
         }
     }
     // Original image
     $info['<i class="fa fa-fw fa-external-link"></i> ' . __('Original')] = HTML::anchor($this->image->get_url(Model_Image::SIZE_ORIGINAL), sprintf('%d&times;%d <small>(%s)</small>', $this->image->original_width, $this->image->original_height, Text::bytes($this->image->original_size, 'kB')), array('target' => '_blank', 'title' => __('Open in new tab')));
     return $info;
 }
Beispiel #2
0
    /**
     * Render view.
     *
     * @return  string
     */
    public function content()
    {
        // Image basic info
        $info = array(__('Copyright') => $this->image->author_id ? HTML::user($this->image->author_id) : null, __('Added') => HTML::time(Date::format('DMYYYY_HM', $this->image->created), $this->image->created), __('Statistics') => '<i class="icon-comment icon-white"></i> ' . (int) $this->image->comment_count . ', ' . '<i class="icon-eye-open icon-white"></i> ' . (int) $this->image->view_count);
        // Image EXIF
        if ($exif = $this->image->exif()) {
            if ($exif->make || $exif->model) {
                $info[__('Camera')] = ($exif->make ? HTML::chars($exif->make) : '') . ($exif->model ? ($exif->make ? '<br />' : '') . HTML::chars($exif->model) : '');
            }
            if ($exif->exposure) {
                $info[__('Exposure')] = HTML::chars($exif->exposure);
            }
            if ($exif->aperture) {
                $info[__('Aperture')] = HTML::chars($exif->aperture);
            }
            if ($exif->focal) {
                $info[__('Focal length')] = HTML::chars($exif->focal);
            }
            if ($exif->iso) {
                $info[__('ISO speed')] = HTML::chars($exif->iso);
            }
            if ($exif->taken) {
                $info[__('Taken')] = Date::format('DMYYYY_HM', $exif->taken);
            }
            if ($exif->flash) {
                $info[__('Flash')] = HTML::chars($exif->flash);
            }
            if ($exif->program) {
                $info[__('Program')] = HTML::chars($exif->program);
            }
            if ($exif->metering) {
                $info[__('Metering')] = HTML::chars($exif->metering);
            }
            if ($exif->latitude) {
                $info[__('Latitude')] = HTML::chars($exif->latitude);
            }
            if ($exif->longitude) {
                $info[__('Longitude')] = HTML::chars($exif->longitude);
            }
            if ($exif->altitude) {
                $info[__('Altitude')] = HTML::chars($exif->altitude) . 'm';
            }
            if ($exif->lens) {
                $info[__('Lens')] = HTML::chars($exif->lens);
            }
        }
        ob_start();
        if (!empty($info)) {
            ?>

	<dl class="dl-horizontal">
		<?php 
            foreach ($info as $term => $definition) {
                if (!is_null($definition)) {
                    ?>

		<dt><?php 
                    echo $term;
                    ?>
</dt><dd><?php 
                    echo $definition;
                    ?>
</dd>
		<?php 
                }
            }
            ?>

	</dl>

<?php 
        }
        return ob_get_clean();
    }