From 0a585f16791b024b40cdc7e5833faf4ad775c021 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 29 Sep 2005 20:41:42 +0000 Subject: [PATCH] Fix: Pied de page propal azur et erreur apercu --- htdocs/comm/propal/apercu.php | 38 +++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/htdocs/comm/propal/apercu.php b/htdocs/comm/propal/apercu.php index 8a2362d8c21..b08ed5b4875 100644 --- a/htdocs/comm/propal/apercu.php +++ b/htdocs/comm/propal/apercu.php @@ -192,22 +192,25 @@ if ($_GET["propalid"] > 0) { /* - * Documents - * - */ + * Documents + */ $propalref = sanitize_string($propal->ref); $file = $conf->propal->dir_output . "/" . $propalref . "/" . $propalref . ".pdf"; $filedetail = $conf->propal->dir_output . "/" . $propalref . "/" . $propalref . "-detail.pdf"; $relativepath = "${propalref}/${propalref}.pdf"; $relativepathdetail = "${propalref}/${propalref}-detail.pdf"; - $relativepathimage = "${propalref}/${propalref}.pdf.png"; - $fileimage = $file.".png"; + // Chemin vers png aperçus + $relativepathimage = "${propalref}/${propalref}.pdf.png"; + $relativepathimagebis = "${propalref}/${propalref}.pdf.png.0"; + $fileimage = $file.".png"; // Si PDF d'1 page + $fileimagebis = $file.".png.0"; // Si PDF de plus d'1 page $var=true; // Si fichier PDF existe - if (file_exists($file)) { + if (file_exists($file)) + { $encfile = urlencode($file); print_titre($langs->trans("Documents")); print ''; @@ -229,18 +232,23 @@ if ($_GET["propalid"] > 0) { print ''; } print "
\n"; + // Conversion du PDF en image png si fichier png non existant - if (!file_exists($fileimage)) { - if (function_exists(imagick_readimage)) { + if (! file_exists($fileimage) && ! file_exists($fileimagebis)) + { + if (function_exists("imagick_readimage")) + { $handle = imagick_readimage( $file ) ; - if ( imagick_iserror( $handle ) ) { + if ( imagick_iserror( $handle ) ) + { $reason = imagick_failedreason( $handle ) ; $description = imagick_faileddescription( $handle ) ; print "handle failed!
\nReason: $reason
\nDescription: $description
\n"; } imagick_convert( $handle, "PNG" ) ; - if ( imagick_iserror( $handle ) ) { + if ( imagick_iserror( $handle ) ) + { $reason = imagick_failedreason( $handle ) ; $description = imagick_faileddescription( $handle ) ; print "handle failed!
\nReason: $reason
\nDescription: $description
\n"; @@ -248,7 +256,7 @@ if ($_GET["propalid"] > 0) { imagick_writeimage( $handle, $file .".png"); } else { $langs->load("other"); - print $langs->trans("ErrorNoImagickReadimage"); + print ''.$langs->trans("ErrorNoImagickReadimage").''; } } } @@ -277,10 +285,18 @@ if ($_GET["propalid"] > 0) { } } +// Si fichier png PDF d'1 page trouvé if (file_exists($fileimage)) { print ''; } +// Si fichier png PDF de plus d'1 page trouvé +elseif (file_exists($fileimagebis)) + { + print ''; + } + + print ''; $db->close();