From 2976754d29232e879d89a655845f5c2d0056a6db Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 7 Feb 2016 11:16:00 -0800 Subject: [PATCH] Compress the secureImg. TinyMce also decoding theme SEF image URLs now. --- e107.htaccess | 2 +- e107_handlers/secure_img_handler.php | 4 ++-- e107_plugins/tinymce4/plugins/e107/parser.php | 13 +++++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/e107.htaccess b/e107.htaccess index 74b4901be..43a4e32fd 100644 --- a/e107.htaccess +++ b/e107.htaccess @@ -94,7 +94,7 @@ ExpiresByType text/x-javascript "access plus 1 month" -### Gzip Compression Module +### Gzip Compression Module AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css text/javascript application/x-javascript application/javascript application/xml text/xml application/rss+xml diff --git a/e107_handlers/secure_img_handler.php b/e107_handlers/secure_img_handler.php index 35db879d1..0eacf5649 100644 --- a/e107_handlers/secure_img_handler.php +++ b/e107_handlers/secure_img_handler.php @@ -391,10 +391,10 @@ class secure_image switch($type) { case "jpeg": - imagejpeg($image); + imagejpeg($image, null, 60 ); break; case "png": - imagepng($image); + imagepng($image, null, 9); break; case "gif": imagegif($image); diff --git a/e107_plugins/tinymce4/plugins/e107/parser.php b/e107_plugins/tinymce4/plugins/e107/parser.php index 634ef2978..36d608660 100644 --- a/e107_plugins/tinymce4/plugins/e107/parser.php +++ b/e107_plugins/tinymce4/plugins/e107/parser.php @@ -249,6 +249,19 @@ TEMPL; $hKey => $match[4] ); } + elseif(preg_match('/theme\/img\/(a)?([\d]*)x(a)?([\d]*)\/(.*)/', $url, $match)) // Theme-image SEF Urls + { + $wKey = $match[1].'w'; + $hKey = $match[3].'h'; + + $ret = array( + 'src'=> 'e_THEME/'.$match[5], + $wKey => $match[2], + $hKey => $match[4] + ); + + } + return $ret; }