Skip to content
Snippets Groups Projects
Commit eebaff95 authored by Laurent Destailleur's avatar Laurent Destailleur
Browse files

Fix pb with imagick

parent 22ca29a5
Branches main
No related tags found
No related merge requests found
...@@ -1565,12 +1565,14 @@ function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile= ...@@ -1565,12 +1565,14 @@ function dol_remove_file_process($filenb,$donotupdatesession=0,$donotdeletefile=
* @param string $fileinput Input file name * @param string $fileinput Input file name
* @param string $ext Format of target file (It is also extension added to file if fileoutput is not provided). * @param string $ext Format of target file (It is also extension added to file if fileoutput is not provided).
* @param string $fileoutput Output filename * @param string $fileoutput Output filename
* @return int <0 if KO, >0 if OK * @return int <0 if KO, 0=Nothing done, >0 if OK
*/ */
function dol_convert_file($fileinput,$ext='png',$fileoutput='') function dol_convert_file($fileinput,$ext='png',$fileoutput='')
{ {
global $langs; global $langs;
if (class_exists('Imagick'))
{
$image=new Imagick(); $image=new Imagick();
$ret = $image->readImage($fileinput); $ret = $image->readImage($fileinput);
if ($ret) if ($ret)
...@@ -1595,6 +1597,11 @@ function dol_convert_file($fileinput,$ext='png',$fileoutput='') ...@@ -1595,6 +1597,11 @@ function dol_convert_file($fileinput,$ext='png',$fileoutput='')
return -1; return -1;
} }
} }
else
{
return 0;
}
}
/** /**
......
...@@ -1235,10 +1235,13 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r ...@@ -1235,10 +1235,13 @@ function dol_banner_tab($object, $paramid, $morehtml='', $shownav=1, $fieldid='r
if ( (! file_exists($fileimage) || (filemtime($fileimage) < filemtime($file))) if ( (! file_exists($fileimage) || (filemtime($fileimage) < filemtime($file)))
&& (! file_exists($fileimagebis) || (filemtime($fileimagebis) < filemtime($file))) && (! file_exists($fileimagebis) || (filemtime($fileimagebis) < filemtime($file)))
) )
{
if (empty($conf->global->MAIN_DISABLE_PDF_THUMBS)) // If you experienc trouble with pdf thumb generation and imagick, you can disable here.
{ {
$ret = dol_convert_file($file, 'png', $fileimage); $ret = dol_convert_file($file, 'png', $fileimage);
if ($ret < 0) $error++; if ($ret < 0) $error++;
} }
}
$heightforphotref=70; $heightforphotref=70;
if (! empty($conf->dol_optimize_smallscreen)) $heightforphotref=60; if (! empty($conf->dol_optimize_smallscreen)) $heightforphotref=60;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment