diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php
index 1c3481fb1f6..de8f758d8e4 100644
--- a/htdocs/core/class/commonobject.class.php
+++ b/htdocs/core/class/commonobject.class.php
@@ -8767,9 +8767,10 @@ abstract class CommonObject
* @param int $nolink Do not add a href link to view enlarged imaged into a new tab
* @param int|string $overwritetitle Do not add title tag on image
* @param int $usesharelink Use the public shared link of image (if not available, the 'nophoto' image will be shown instead)
+ * @param string $cache A string if we want to use a cached version of image
* @return string Html code to show photo. Number of photos shown is saved in this->nbphoto
*/
- public function show_photos($modulepart, $sdir, $size = 0, $nbmax = 0, $nbbyrow = 5, $showfilename = 0, $showaction = 0, $maxHeight = 120, $maxWidth = 160, $nolink = 0, $overwritetitle = 0, $usesharelink = 0)
+ public function show_photos($modulepart, $sdir, $size = 0, $nbmax = 0, $nbbyrow = 5, $showfilename = 0, $showaction = 0, $maxHeight = 120, $maxWidth = 160, $nolink = 0, $overwritetitle = 0, $usesharelink = 0, $cache = '')
{
// phpcs:enable
global $conf, $user, $langs;
@@ -8854,13 +8855,11 @@ abstract class CommonObject
if ($nbphoto % $nbbyrow == 1) {
$return .= '
';
}
- $return .= '| ';
+ $return .= ' | '."\n";
} elseif ($nbbyrow < 0) {
- $return .= '';
+ $return .= ' '."\n";
}
- $return .= "\n";
-
$relativefile = preg_replace('/^\//', '', $pdir.$photo);
if (empty($nolink)) {
$urladvanced = getAdvancedPreviewUrl($modulepart, $relativefile, 0, 'entity='.$this->entity);
@@ -8889,10 +8888,10 @@ abstract class CommonObject
if ($val['share']) {
if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) {
$return .= '';
- $return .= ' .') ';
+ $return .= ' .($cache ? '&cache='.urlencode($cache) : '').') ';
} else {
$return .= '';
- $return .= ' .') ';
+ $return .= ' .($cache ? '&cache='.urlencode($cache) : '').') ';
}
} else {
$return .= '';
@@ -8901,17 +8900,16 @@ abstract class CommonObject
} else {
if (empty($maxHeight) || ($photo_vignette && $imgarray['height'] > $maxHeight)) {
$return .= '';
- $return .= ' .') ';
+ $return .= '  : '').'&file='.urlencode($pdirthumb.$photo_vignette).') ';
} else {
$return .= '';
- $return .= ' .') ';
+ $return .= '  : '').'&file='.urlencode($pdir.$photo).') ';
}
}
if (empty($nolink)) {
$return .= '';
}
- $return .= "\n";
if ($showfilename) {
$return .= ' '.$viewfilename;
@@ -8940,7 +8938,7 @@ abstract class CommonObject
$return .= ' |
';
}
} elseif ($nbbyrow < 0) {
- $return .= '';
+ $return .= ''."\n";
}
}
diff --git a/htdocs/product/class/product.class.php b/htdocs/product/class/product.class.php
index 243d31e2c1d..c2de9c24770 100644
--- a/htdocs/product/class/product.class.php
+++ b/htdocs/product/class/product.class.php
@@ -5032,10 +5032,9 @@ class Product extends CommonObject
}
if (!empty($this->entity)) {
- $tmpphoto = $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80);
+ $tmpphoto = $this->show_photos('product', $conf->product->multidir_output[$this->entity], 1, 1, 0, 0, 0, 80, 0, 0, 0, 0, 1);
if ($this->nbphoto > 0) {
- $datas['photo'] = '' . $tmpphoto . '
';
- //$label .= '';
+ $datas['photo'] = ''."\n" . $tmpphoto . '
';
}
}
@@ -5172,9 +5171,9 @@ class Product extends CommonObject
if (empty($notooltip)) {
if (!empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
$label = $langs->trans("ShowProduct");
- $linkclose .= ' alt="'.dol_escape_htmltag($label, 1).'"';
+ $linkclose .= ' alt="'.dol_escape_htmltag($label, 1, 1).'"';
}
- $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1).'"' : ' title="tocomplete"');
+ $linkclose .= ($label ? ' title="'.dol_escape_htmltag($label, 1, 1).'"' : ' title="tocomplete"');
$linkclose .= $dataparams.' class="nowraponall '.$classfortooltip.($morecss ? ' '.$morecss : '').'"';
} else {
$linkclose = ' class="nowraponall'.($morecss ? ' '.$morecss : '').'"';
diff --git a/htdocs/viewimage.php b/htdocs/viewimage.php
index 51df71c85ef..8cd37f2e96f 100644
--- a/htdocs/viewimage.php
+++ b/htdocs/viewimage.php
@@ -153,8 +153,8 @@ if ($modulepart == 'fckeditor') {
*/
if (GETPOST("cache", 'alpha')) {
- // Important: Following code is to avoid page request by browser and PHP CPU at
- // each Dolibarr page access.
+ // Important: Following code is to avoid page request by browser and PHP CPU at each Dolibarr page access.
+ // Add param cache=abcdef
if (empty($dolibarr_nocache)) {
header('Cache-Control: max-age=3600, public, must-revalidate');
header('Pragma: cache'); // This is to avoid having Pragma: no-cache