Exemplo n.º 1
0
/**
* Obtain the size of the specified gallery avatar (using the cache if possible) and cache the value
*/
function get_gallery_avatar_dim($source, $axis)
{
    if (empty($source)) {
        return 0;
    }
    static $avatar_cache = array();
    if (isset($avatar_cache[$source])) {
        return $avatar_cache[$source][$axis];
    }
    global $convert, $phpbb_root_path, $config, $user;
    $orig_source = $source;
    if (!isset($convert->convertor['avatar_gallery_path'])) {
        $convert->p_master->error(sprintf($user->lang['CONV_ERROR_NO_GALLERY_PATH'], 'get_gallery_avatar_dim()'), __LINE__, __FILE__);
    }
    if (!empty($convert->convertor['avatar_gallery_path']) && strpos($source, $convert->convertor['avatar_gallery_path']) !== 0) {
        $source = path($convert->convertor['avatar_gallery_path'], empty($convert->convertor['source_path_absolute'])) . $source;
    }
    $avatar_cache[$orig_source] = get_image_dim($source);
    if (empty($avatar_cache[$orig_source]) || empty($avatar_cache[$orig_source][0]) || empty($avatar_cache[$orig_source][1])) {
        $default_x = defined('DEFAULT_AVATAR_X_CUSTOM') ? DEFAULT_AVATAR_X_CUSTOM : DEFAULT_AVATAR_X;
        $default_y = defined('DEFAULT_AVATAR_Y_CUSTOM') ? DEFAULT_AVATAR_Y_CUSTOM : DEFAULT_AVATAR_Y;
        $avatar_cache[$orig_source] = array($default_x, $default_y);
    }
    return $avatar_cache[$orig_source][$axis];
}
Exemplo n.º 2
0
function mybb_icon_dim($source, $axis)
{
	static $cache;

	$source = mybb_get_absolute_path($source);

	if (empty($cache[$source]))
	{
		global $convert;

		$cache[$source] = get_image_dim($source);
	}
	return $cache[$source][$axis];
}