Ignore:
Timestamp:
Feb 18, 2012, 9:46:46 PM (12 years ago)
Author:
rvelices
Message:
  • multisize thumb longest side can be smaller than the square size
  • remove unused css, shorten/optimize php called very often (at least theoretically should be faster)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions.inc.php

    r13234 r13240  
    817817
    818818
    819 /* Returns the PATH to the thumbnail to be displayed. If the element does not
    820  * have a thumbnail, the default mime image path is returned. The PATH can be
    821  * used in the php script, but not sent to the browser.
    822  * @param array element_info assoc array containing element info from db
    823  * at least 'path', 'tn_ext' and 'id' should be present
    824  */
    825 function get_thumbnail_path($element_info)
    826 {
    827   $path = get_thumbnail_location($element_info);
    828   if ( !url_is_remote($path) )
    829   {
    830     $path = PHPWG_ROOT_PATH.$path;
    831   }
    832   return $path;
    833 }
    834 
    835819/* Returns the URL of the thumbnail to be displayed. If the element does not
    836820 * have a thumbnail, the default mime image url is returned. The URL can be
     
    842826{
    843827  return DerivativeImage::thumb_url($element_info);
    844 }
    845 
    846 /* returns the relative path of the thumnail with regards to to the root
    847 of piwigo (not the current page!).This function is not intended to be
    848 called directly from code.*/
    849 function get_thumbnail_location($element_info)
    850 {
    851   global $conf;
    852   if ( !empty( $element_info['tn_ext'] ) )
    853   {
    854     $path = substr_replace(
    855       get_filename_wo_extension($element_info['path']),
    856       '/'.$conf['dir_thumbnail'].'/'.$conf['prefix_thumbnail'],
    857       strrpos($element_info['path'],'/'),
    858       1
    859       );
    860     $path.= '.'.$element_info['tn_ext'];
    861   }
    862   else
    863   {
    864     $path = get_themeconf('mime_icon_dir')
    865         .strtolower(get_extension($element_info['path'])).'.png';
    866     // plugins want another location ?
    867     $path = trigger_event( 'get_thumbnail_location', $path, $element_info);
    868   }
    869   return $path;
    870828}
    871829
     
    921879 * @return string
    922880 */
    923 function l10n($key, $textdomain='messages')
     881function l10n($key)
    924882{
    925883  global $lang, $conf;
    926884
    927   if ($conf['debug_l10n'] and !isset($lang[$key]) and !empty($key))
    928   {
    929     trigger_error('[l10n] language key "'.$key.'" is not defined', E_USER_WARNING);
    930   }
    931 
    932   return isset($lang[$key]) ? $lang[$key] : $key;
     885        if ( ($val=@$lang[$key]) == null)
     886        {
     887                if ($conf['debug_l10n'] and !isset($lang[$key]) and !empty($key))
     888                {
     889                        trigger_error('[l10n] language key "'.$key.'" is not defined', E_USER_WARNING);
     890                }
     891                $val = $key;
     892        }
     893  return $val;
    933894}
    934895
Note: See TracChangeset for help on using the changeset viewer.