Skip to content

Commit

Permalink
Fix pb with svg images
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Dec 19, 2019
1 parent 44978db commit 03649ea
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions htdocs/core/lib/images.lib.php
Expand Up @@ -33,7 +33,7 @@
* Return if a filename is file name of a supported image format
*
* @param string $file Filename
* @return int -1=Not image filename, 0=Image filename but format not supported by PHP, 1=Image filename with format supported by this PHP
* @return int -1=Not image filename, 0=Image filename but format not supported for conversion by PHP, 1=Image filename with format supported by this PHP
*/
function image_format_supported($file)
{
Expand All @@ -57,12 +57,12 @@ function image_format_supported($file)
{
if (!function_exists($imgfonction))
{
// Fonctions de conversion non presente dans ce PHP
// Fonctions of conversion not available in this PHP
return 0;
}
}

// Filename is a format image and supported by this PHP
// Filename is a format image and supported for conversion by this PHP
return 1;
}

Expand Down
12 changes: 8 additions & 4 deletions htdocs/product/class/product.class.php
Expand Up @@ -4835,8 +4835,10 @@ public function is_photo_available($sdir)
global $conf;

$dir = $sdir;
if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) { $dir .= '/'.get_exdir($this->id, 2, 0, 0, $this, 'product').$this->id."/photos/";
} else { $dir .= '/'.get_exdir(0, 0, 0, 0, $this, 'product').dol_sanitizeFileName($this->ref).'/';
if (!empty($conf->global->PRODUCT_USE_OLD_PATH_FOR_PHOTO)) {
$dir .= '/'.get_exdir($this->id, 2, 0, 0, $this, 'product').$this->id."/photos/";
} else {
$dir .= '/'.get_exdir(0, 0, 0, 0, $this, 'product').dol_sanitizeFileName($this->ref).'/';
}

$nbphoto = 0;
Expand All @@ -4847,9 +4849,11 @@ public function is_photo_available($sdir)
if (is_resource($handle)) {
while (($file = readdir($handle)) !== false)
{
if (!utf8_check($file)) { $file = utf8_encode($file); // To be sure data is stored in UTF8 in memory
if (!utf8_check($file)) {
$file = utf8_encode($file); // To be sure data is stored in UTF8 in memory
}
if (dol_is_file($dir.$file) && image_format_supported($file) > 0) { return true;
if (dol_is_file($dir.$file) && image_format_supported($file) >= 0) {
return true;
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion htdocs/theme/eldy/global.inc.php
Expand Up @@ -1446,7 +1446,7 @@
min-height: 80px;
}
div.divphotoref {
padding-<?php echo $right; ?>: 20px;
padding-<?php echo $right; ?>: 10px;
}
div.paginationref {
padding-bottom: 10px;
Expand Down Expand Up @@ -3602,6 +3602,7 @@
.photowithmargin {
margin-bottom: 2px;
margin-top: 10px;
margin-right: 10px;
}
.photowithborder {
border: 1px solid #f0f0f0;
Expand Down

0 comments on commit 03649ea

Please sign in to comment.