diff --git a/classes/FileItem.php b/classes/FileItem.php
index 158cb3d..d8ccfc0 100644
--- a/classes/FileItem.php
+++ b/classes/FileItem.php
@@ -2,9 +2,9 @@
/**
* @package AutoIndex
*
- * @copyright Copyright (C) 2002-2004 Justin Hagstrom, 2019-2023 Florin C Bodin aka orynider at github.com
+ * @copyright Copyright (C) 2002-2004 Justin Hagstrom, 2019-2025 Florin C Bodin aka orynider at github.com
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License (GPL)
- * @version $Id: FileItem.php, v 2.2.6 2023/11/15 08:08:08 orynider Exp $
+ * @version $Id: FileItem.php, v 2.2.6 2025/09/08 19:25:08 orynider Exp $
* @link http://autoindex.sourceforge.net
*/
@@ -87,6 +87,17 @@ class FileItem extends Item
throw new ExceptionDisplay('File ' . Url::html_output($this->parent_dir . $filename) . ' does not exist.');
}
global $config, $words, $downloads, $request;
+
+ $version_compare = explode(".", phpversion(), 3);
+ if ($version_compare[0] == '' || $version_compare[1] == '')
+ {
+ $phpversion = '5.4';
+ }
+ else
+ {
+ $phpversion = $version_compare[0] . '.' . $version_compare[1];
+ }
+
$this->filename = $filename;
$this->size = new Size(filesize($this->parent_dir . $filename));
if (ICON_PATH)
@@ -109,7 +120,7 @@ class FileItem extends Item
. ' >' . $words->__get('view') . ' ' . $words->__get('file') . '';
}
- if (THUMBNAIL_HEIGHT && in_array(self::ext($filename), array('svg', 'SVG')))
+ if (in_array(self::ext($filename), array('svg', 'SVG')))
{
$svgcontent = false;
$svgcontent = file_get_contents(Url::translate_uri($this->parent_dir . $filename));
@@ -123,18 +134,51 @@ class FileItem extends Item
{
$width = explode('" ', $content[2]);
$width = !empty($width[0]) ? str_replace('"', '', $width[0]) : '32';
+ $width = ($width < '14') ? '32' : $width;
+ $width = ($width == '100%') ? '400' : $width;
}
- $svgcontent = ($width > '400') ? str_replace($width, $width/1.1, $svgcontent) : $svgcontent;
- $svgcontent = ($width < '24') ? str_replace($width, $width*1.5*2, $svgcontent) : $svgcontent;
+ else
+ {
+ $width = '200';
+ $height = '200';
+
+ }
+ $svgcontent = str_replace('width="100%"', 'width="'.$width.'"', $svgcontent);
+ $svgcontent = str_replace('height="100%"', 'height="'.$height.'"', $svgcontent);
+ if (version_compare($phpversion, "6.0", ">"))
+ {
+ //die("you're on ".$phpversion." or bellow".phpversion().' &'.print_R($version_compare, true));
+ $svgcontent = ($width > '400') ? str_replace($width, $width / 1.1, $svgcontent) : $svgcontent;
+ $svgcontent = ($width < '24') ? str_replace($width, $width * 1.5 * 2, $svgcontent) : $svgcontent;
+
+ }
+ else
+ {
+ //die("you're on ".$phpversion." or above: ".phpversion().' &'.print_R($version_compare, true));
+ $svgcontent = ($width > '400') ? str_replace($width, '200', $svgcontent) : $svgcontent;
+ $svgcontent = ($width < '24') ? str_replace($width, '24', $svgcontent) : $svgcontent;
+ }
+
$svgcontent = ('edit.svg' === basename($filename)) ? str_replace($width, '200', $svgcontent) : $svgcontent;
if(preg_match_all('/