use svg image itself as thumbnail

This commit is contained in:
Ralf Becker 2016-02-29 13:05:48 +00:00
parent 1095c6e5b9
commit 68374ff0a3
2 changed files with 11 additions and 2 deletions

View File

@ -300,9 +300,9 @@ function exif_thumbnail_load($file)
function gd_image_load($file,$maxw,$maxh)
{
// Get mime type
list($type, $image_type) = explode('/', egw_vfs::mime_content_type($file));
list($type, $image_type) = explode('/', $mime = egw_vfs::mime_content_type($file));
// if $file is not from vfs, use mime_magic::filename2mime to get mime-type from extension
if (!$type) list($type, $image_type) = explode('/', mime_magic::filename2mime($file));
if (!$type) list($type, $image_type) = explode('/', $mime = mime_magic::filename2mime($file));
// Call the according gd constructor depending on the file type
if($type == 'image')
@ -321,6 +321,10 @@ function gd_image_load($file,$maxw,$maxh)
return imagecreatefromgif($file);
case 'bmp':
return imagecreatefromwbmp($file);
case 'svg+xml':
html::content_header(egw_vfs::basename($file), $mime);
readfile($file);
common::egw_exit();
}
}
else if ($type == 'application')

View File

@ -150,6 +150,11 @@ egw.extend('images', egw.MODULE_GLOBAL, function() {
if (_mtime) params.mtime = _mtime;
image = this.link('/etemplate/thumbnail.php', params);
}
// for svg return image itself
else if (type[0] == 'image' && type[1] == 'svg+xml')
{
image = this.webserverUrl+'/webdav.php'+_path;
}
else
{
if ((typeof type[1] == 'undefined' || !(image = this.image('mime'+_size+'_'+type[0]+'_'+type[1], 'etemplate')) &&