diff --git a/classes/FileItem.php b/classes/FileItem.php index 17f73c5..158cb3d 100644 --- a/classes/FileItem.php +++ b/classes/FileItem.php @@ -108,7 +108,43 @@ class FileItem extends Item . ' alt="' . $words->__get('thumbnail of') . ' ' . $filename . '"' . ' >' . $words->__get('view') . ' ' . $words->__get('file') . ''; } - elseif (THUMBNAIL_HEIGHT && in_array(self::ext($filename), array('thm', 'thm'))) + + if (THUMBNAIL_HEIGHT && in_array(self::ext($filename), array('svg', 'SVG'))) + { + $svgcontent = false; + $svgcontent = file_get_contents(Url::translate_uri($this->parent_dir . $filename)); + $width = $height = '32'; + // + $contentsvg = explode(' + $content = explode('=', $contentsvg[1]); + //[0] => xmlns [1] => "http://www.w3.org/2000/svg" width [2] => "32" height [3] => "32" viewBox [4] => "0 0 32 32"> + if(preg_match('/]*width=\"(.*)\"\/>/isU', ' '400') ? str_replace($width, $width/1.1, $svgcontent) : $svgcontent; + $svgcontent = ($width < '24') ? str_replace($width, $width*1.5*2, $svgcontent) : $svgcontent; + $svgcontent = ('edit.svg' === basename($filename)) ? str_replace($width, '200', $svgcontent) : $svgcontent; + if(preg_match_all('/]*height=\"(.*)\"\/>/isU', ' '400') ? str_replace($height, $height/1.1, $svgcontent) : $svgcontent; + $svgcontent = ($width < '24') ? str_replace($height, $height*1.5*2, $svgcontent) : $svgcontent; + $svgcontent = ('' === basename($filename)) ? str_replace($height, '200', $svgcontent) : $svgcontent; + if(preg_match_all('/]*viewBox=\"(.*)\"\/>/isU', 'thumb_link = ''.$svgcontent.''; + } + + if (THUMBNAIL_HEIGHT && in_array(self::ext($filename), array('thm', 'thm'))) { $this->thumb_link = ' __get('icon_path') . 'svg.png') : Url::translate_uri($this->parent_dir . $filename); @@ -245,13 +282,8 @@ class FileItem extends Item . '?thumbnail='. Url::translate_uri($icon_svg) . '"' . ' alt="' . $words->__get('thumbnail of') . ' ' . $filename . '"' . ' />'; - //. ' ' . $words->__get('thumbnail of') . ' ' . $filename . ''; } - + */ $size = $this->size->__get('bytes'); if (MD5_SHOW && $size > 0 && $size / 1048576 <= $config->__get('md5_show')) {