Exemplo n.º 1
0
 /**
  * @param array $infos assoc array of data from images table
  */
 function __construct($infos)
 {
     global $conf;
     $this->id = $infos['id'];
     $ext = get_extension($infos['path']);
     if (in_array($ext, $conf['picture_ext'])) {
         $this->rel_path = $infos['path'];
         $this->flags |= self::IS_ORIGINAL;
     } elseif (!empty($infos['representative_ext'])) {
         $this->rel_path = original_to_representative($infos['path'], $infos['representative_ext']);
     } else {
         $ext = strtolower($ext);
         $this->rel_path = trigger_change('get_mimetype_location', get_themeconf('mime_icon_dir') . $ext . '.png', $ext);
         $this->flags |= self::IS_MIMETYPE;
         if (($size = @getimagesize(PHPWG_ROOT_PATH . $this->rel_path)) === false) {
             $this->rel_path = 'themes/default/icon/mimetypes/unknown.png';
             $size = getimagesize(PHPWG_ROOT_PATH . $this->rel_path);
         }
         $this->size = array($size[0], $size[1]);
     }
     if (!$this->size) {
         if (isset($infos['width']) && isset($infos['height'])) {
             $width = $infos['width'];
             $height = $infos['height'];
             $this->rotation = intval($infos['rotation']) % 4;
             // 1 or 5 =>  90 clockwise
             // 3 or 7 => 270 clockwise
             if ($this->rotation % 2) {
                 $width = $infos['height'];
                 $height = $infos['width'];
             }
             $this->size = array($width, $height);
         } elseif (!array_key_exists('width', $infos)) {
             $this->flags |= self::DIM_NOT_GIVEN;
         }
     }
 }
Exemplo n.º 2
0
/**
 * Returns the breadcrumb to be displayed above thumbnails on tag page.
 *
 * @return string
 */
function get_tags_content_title()
{
    global $page;
    $title = '<a href="' . get_root_url() . 'tags.php" title="' . l10n('display available tags') . '">' . l10n(count($page['tags']) > 1 ? 'Tags' : 'Tag') . '</a> ';
    for ($i = 0; $i < count($page['tags']); $i++) {
        $title .= $i > 0 ? ' + ' : '';
        $title .= '<a href="' . make_index_url(array('tags' => array($page['tags'][$i]))) . '" title="' . l10n('display photos linked to this tag') . '">' . trigger_change('render_tag_name', $page['tags'][$i]['name'], $page['tags'][$i]) . '</a>';
        if (count($page['tags']) > 2) {
            $other_tags = $page['tags'];
            unset($other_tags[$i]);
            $remove_url = make_index_url(array('tags' => $other_tags));
            $title .= '<a href="' . $remove_url . '" style="border:none;" title="' . l10n('remove this tag from the list') . '"><img src="' . get_root_url() . get_themeconf('icon_dir') . '/remove_s.png' . '" alt="x" style="vertical-align:bottom;">' . '</a>';
        }
    }
    return $title;
}