diff mgallery.php @ 253:5b41efcec87d

More work on webp/etc support implementation.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 12 Dec 2018 13:34:24 +0200
parents f85870271f51
children d536c57fa952
line wrap: on
line diff
--- a/mgallery.php	Wed Dec 12 13:02:07 2018 +0200
+++ b/mgallery.php	Wed Dec 12 13:34:24 2018 +0200
@@ -184,10 +184,10 @@
 }
 
 
-function mgGetImageURL()
+function mgGetImageURL($fpath, $filename, $ffmt)
 {
   global $galImageURL, $galPath;
-  return str_replace("//", "/", $galImageURL.$galPath."/".implode("", func_get_args()));
+  return str_replace("//", "/", $galImageURL.$galPath."/".$fpath.$filename.".".$ffmt);
 }
 
 
@@ -225,14 +225,14 @@
 
 function mgGetNaviControlImage(&$galIndex, $index, $class, $url)
 {
-  global $galTNPath;
+  global $galTNPath, $galTNFormat;
 
   if ($url !== FALSE)
   {
     return
       "<div class=\"imageCtrl ".$class."\">".
       "<a href=\"".$url."\"><img src=\"".
-      mgGetImageURL($galTNPath, $galIndex[$index]).
+      mgGetImageURL($galTNPath, $galIndex[$index], $galTNFormat).
       "\" alt=\"".$galIndex[$index]."\" /></a></div>";
   }
   else
@@ -263,7 +263,8 @@
 
 function mgPrintTable($class, &$galEntries, &$galIndex, $start, $limit)
 {
-  global $galAlbumIcon, $galPath, $galTNPath, $galImageURL, $galUseCoverImages;
+  global $galAlbumIcon, $galPath, $galTNPath, $galTNFormat,
+         $galImageURL, $galUseCoverImages;
 
   $galCount = count($galIndex);
   if ($start >= $galCount)
@@ -286,7 +287,7 @@
       echo
         "    <div class=\"imageBox\" title=\"".mgGetImageTitleStr($filename, $data).
         "\"><a href=\"".mgGetURL($galPath, $filename)."\"><img src=\"".
-        mgGetImageURL($galTNPath, $filename).
+        mgGetImageURL($galTNPath, $filename, $galTNFormat).
         "\" alt=\"".dhentities($filename)."\"></a></div>\n".
         mgGetArr($data, "caption", "    <div class=\"imageCaption\">%1</div>\n", "", "chentities");
 /*
@@ -455,6 +456,8 @@
 $galCleanURLS = mgGetSetting("clean_urls");
 $galTNPath = mgGetSetting("tn_path");
 $galMedPath = mgGetSetting("med_path");
+$galTNFormat = mgGetSetting("tn_format");
+$galMedFormat = mgGetSetting("med_format");
 $galTitlePrefix = mgGetSetting("title_prefix");
 $galTitleSep = mgGetSetting("title_sep");
 
@@ -571,7 +574,7 @@
       mgGetNaviControlImageBoxJS($galImagesIndex, $index, "prevBtm", -1)."\n".
       mgGetNaviControlImageBox($galImagesIndex, $index, "prev", -1)."\n".
       "<div id=\"imageImageBox\" class=\"imageBox\">".
-        "<img id=\"imageImage\" src=\"".mgGetImageURL($galMedPath, $galImage).
+        "<img id=\"imageImage\" src=\"".mgGetImageURL($galMedPath, $galImage, $galMedFormat).
         "\" alt=\"".chentities($galImage)."\">".
       "</div>\n".
       mgGetNaviControlImageBoxJS($galImagesIndex, $index, "nextBtm", 1)."\n".