From 68374ff0a3e0be37ea6536e2ad4cb5276e5623c6 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Mon, 29 Feb 2016 13:05:48 +0000 Subject: [PATCH] use svg image itself as thumbnail --- etemplate/thumbnail.php | 8 ++++++-- phpgwapi/js/jsapi/egw_images.js | 5 +++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/etemplate/thumbnail.php b/etemplate/thumbnail.php index 7f054af3fb..366283ca2a 100644 --- a/etemplate/thumbnail.php +++ b/etemplate/thumbnail.php @@ -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') diff --git a/phpgwapi/js/jsapi/egw_images.js b/phpgwapi/js/jsapi/egw_images.js index 2e5940b04a..ffe7ea55f7 100644 --- a/phpgwapi/js/jsapi/egw_images.js +++ b/phpgwapi/js/jsapi/egw_images.js @@ -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')) &&