set default thumbnail size to 64px and fix IDE warnings

This commit is contained in:
Ralf Becker 2014-12-11 09:57:31 +00:00
parent f0b2131cfd
commit 0b8ad9798c
2 changed files with 17 additions and 23 deletions

View File

@ -81,7 +81,7 @@ function get_app()
*/
function get_maxsize()
{
$preset = (string)$GLOBALS['egw_info']['server']['link_list_thumbnail'] == '' ? 32 :
$preset = !($GLOBALS['egw_info']['server']['link_list_thumbnail'] > 0) ? 64 :
$GLOBALS['egw_info']['server']['link_list_thumbnail'];
// Another maximum size may be passed if thumbnails are turned on
@ -97,7 +97,7 @@ function get_maxsize()
* Either loads the thumbnail for the given file form cache or generates a new
* one
*
* @param string $file is the file of which a thumbnail should be created
* @param string $src is the file of which a thumbnail should be created
* @returns false if the file doesn't exist or any other error occured.
*/
function read_thumbnail($src)
@ -190,10 +190,6 @@ function gen_dstfile($src, $maxsize)
*/
function get_scaled_image_size($w, $h, $maxw, $maxh)
{
//Set the output width to zero
$wout = 0.0;
$hout = 0.0;
//Scale will contain the factor by which the image has to be scaled down
$scale = 1.0;
@ -344,6 +340,7 @@ function gdVersion($user_ver = 0)
// Use the gd_info() function if possible.
if (function_exists('gd_info')) {
$ver_info = gd_info();
$match = null;
preg_match('/\d/', $ver_info['GD Version'], $match);
$gd_ver = $match[0];
return $match[0];
@ -362,10 +359,7 @@ function gdVersion($user_ver = 0)
// ...otherwise use phpinfo().
ob_start();
phpinfo(8);
$info = ob_get_contents();
ob_end_clean();
$info = stristr($info, 'gd version');
preg_match('/\d/', $info, $match);
$gd_ver = $match[0];
$info = stristr(ob_get_clean(), 'gd version');
if (preg_match('/\d/', $info, $match)) $gd_ver = $match[0];
return $match[0];
}

View File

@ -29,7 +29,7 @@ egw.extend('images', egw.MODULE_GLOBAL, function() {
/**
* Set imagemap, called from /phpgwapi/images.php
*
* @param array/object _images
* @param {array|object} _images
*/
set_images: function (_images)
{
@ -39,8 +39,8 @@ egw.extend('images', egw.MODULE_GLOBAL, function() {
/**
* Get image URL for a given image-name and application
*
* @param string _name image-name without extension
* @param string _app application name, default current app of window
* @param {string} _name image-name without extension
* @param {string} _app application name, default current app of window
* @return string with URL of image
*/
image: function (_name, _app)
@ -84,8 +84,8 @@ egw.extend('images', egw.MODULE_GLOBAL, function() {
return this.webserverUrl+images['phpgwapi'][_name];
}
// if no match, check if it might contain an extension
var matches = [];
if (matches = _name.match(/\.(png|gif|jpg)$/i))
var matches = _name.match(/\.(png|gif|jpg)$/i);
if (matches)
{
return this.image(_name.replace(/.(png|gif|jpg)$/i,''), _app);
}
@ -97,9 +97,9 @@ egw.extend('images', egw.MODULE_GLOBAL, function() {
/**
* Get image url for a given mime-type and option file
*
* @param _mime
* @param _path vfs path to generate thumbnails for images
* @param _size defaults to 16 (only supported size currently)
* @param {string} _mime
* @param {string} _path vfs path to generate thumbnails for images
* @param {number} _size defaults to 16 (only supported size currently)
* @returns url of image
*/
mime_icon: function(_mime, _path, _size)
@ -109,15 +109,15 @@ egw.extend('images', egw.MODULE_GLOBAL, function() {
if (_mime == 'httpd/unix-directory') _mime = 'directory';
var type = _mime.toLowerCase().split('/');
var image;
var image = type[0] == 'egw' ? this.image('navbar',type[1]) : undefined;
if (type[0] == 'egw' && (image = this.image('navbar',type[1])))
if (image)
{
}
else if (typeof _path == 'string' && type[0] == 'image' && type[1].match(/^(png|jpe?g|gif|bmp)$/))
{
var thsize = this.config('link_list_thumbnail') || 32;
var thsize = this.config('link_list_thumbnail') || 64;
image = this.link('/etemplate/thumbnail.php',{ 'path': _path, 'thsize': thsize});
}
else
@ -155,6 +155,6 @@ egw.extend('images', egw.MODULE_GLOBAL, function() {
}
return icon;
}
}
};
});