/[dolibarr]/dolibarr/htdocs/comm/propal/apercu.php
ViewVC logotype

Diff of /dolibarr/htdocs/comm/propal/apercu.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.5 by eldy, Fri Sep 16 01:23:29 2005 UTC revision 1.6 by eldy, Thu Sep 29 20:41:42 2005 UTC
# Line 192  if ($_GET["propalid"] > 0) { Line 192  if ($_GET["propalid"] > 0) {
192    
193    
194                                  /*                                  /*
195                                  * Documents                                   * Documents
196                                  *                                   */
                                 */  
197                                  $propalref = sanitize_string($propal->ref);                                  $propalref = sanitize_string($propal->ref);
198                                  $file = $conf->propal->dir_output . "/" . $propalref . "/" . $propalref . ".pdf";                                  $file = $conf->propal->dir_output . "/" . $propalref . "/" . $propalref . ".pdf";
199                                  $filedetail = $conf->propal->dir_output . "/" . $propalref . "/" . $propalref . "-detail.pdf";                                  $filedetail = $conf->propal->dir_output . "/" . $propalref . "/" . $propalref . "-detail.pdf";
200                                  $relativepath = "${propalref}/${propalref}.pdf";                                  $relativepath = "${propalref}/${propalref}.pdf";
201                                  $relativepathdetail = "${propalref}/${propalref}-detail.pdf";                                  $relativepathdetail = "${propalref}/${propalref}-detail.pdf";
                                 $relativepathimage = "${propalref}/${propalref}.pdf.png";  
202    
203                                  $fileimage = $file.".png";                  // Chemin vers png aperçus
204                                    $relativepathimage = "${propalref}/${propalref}.pdf.png";
205                                    $relativepathimagebis = "${propalref}/${propalref}.pdf.png.0";
206                                    $fileimage = $file.".png";          // Si PDF d'1 page
207                                    $fileimagebis = $file.".png.0";     // Si PDF de plus d'1 page
208    
209                                  $var=true;                                  $var=true;
210    
211                                  // Si fichier PDF existe                                  // Si fichier PDF existe
212                                  if (file_exists($file)) {                                  if (file_exists($file))
213                                    {
214                                          $encfile = urlencode($file);                                          $encfile = urlencode($file);
215                                          print_titre($langs->trans("Documents"));                                          print_titre($langs->trans("Documents"));
216                                          print '<table class="border" width="100%">';                                          print '<table class="border" width="100%">';
# Line 229  if ($_GET["propalid"] > 0) { Line 232  if ($_GET["propalid"] > 0) {
232                                                  print '</tr>';                                                  print '</tr>';
233                                          }                                          }
234                                          print "</table>\n";                                          print "</table>\n";
235                                            
236                                          // Conversion du PDF en image png si fichier png non existant                                          // Conversion du PDF en image png si fichier png non existant
237                                          if (!file_exists($fileimage)) {                                          if (! file_exists($fileimage) && ! file_exists($fileimagebis))
238                                                  if (function_exists(imagick_readimage)) {                                          {
239                                                    if (function_exists("imagick_readimage"))
240                                                    {
241                                                          $handle = imagick_readimage( $file ) ;                                                          $handle = imagick_readimage( $file ) ;
242                                                          if ( imagick_iserror( $handle ) ) {                                                          if ( imagick_iserror( $handle ) )
243                                                            {
244                                                                  $reason      = imagick_failedreason( $handle ) ;                                                                  $reason      = imagick_failedreason( $handle ) ;
245                                                                  $description = imagick_faileddescription( $handle ) ;                                                                  $description = imagick_faileddescription( $handle ) ;
246    
247                                                                  print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n";                                                                  print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n";
248                                                          }                                                          }
249                                                          imagick_convert( $handle, "PNG" ) ;                                                          imagick_convert( $handle, "PNG" ) ;
250                                                          if ( imagick_iserror( $handle ) ) {                                                          if ( imagick_iserror( $handle ) )
251                                                            {
252                                                                  $reason      = imagick_failedreason( $handle ) ;                                                                  $reason      = imagick_failedreason( $handle ) ;
253                                                                  $description = imagick_faileddescription( $handle ) ;                                                                  $description = imagick_faileddescription( $handle ) ;
254                                                                  print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n";                                                                  print "handle failed!<BR>\nReason: $reason<BR>\nDescription: $description<BR>\n";
# Line 248  if ($_GET["propalid"] > 0) { Line 256  if ($_GET["propalid"] > 0) {
256                                                          imagick_writeimage( $handle, $file .".png");                                                          imagick_writeimage( $handle, $file .".png");
257                                                  } else {                                                  } else {
258                                                          $langs->load("other");                                                          $langs->load("other");
259                                                          print $langs->trans("ErrorNoImagickReadimage");                                                          print '<font class="error">'.$langs->trans("ErrorNoImagickReadimage").'</font>';
260                                                  }                                                  }
261                                          }                                          }
262                                  }                                  }
# Line 277  if ($_GET["propalid"] > 0) { Line 285  if ($_GET["propalid"] > 0) {
285          }          }
286  }  }
287    
288    // Si fichier png PDF d'1 page trouvé
289  if (file_exists($fileimage))  if (file_exists($fileimage))
290          {          {
291          print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&file='.urlencode($relativepathimage).'">';          print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&file='.urlencode($relativepathimage).'">';
292          }          }
293    // Si fichier png PDF de plus d'1 page trouvé
294    elseif (file_exists($fileimagebis))
295            {
296            print '<img src="'.DOL_URL_ROOT . '/viewimage.php?modulepart=apercupropal&file='.urlencode($relativepathimagebis).'">';
297            }
298    
299    
300  print '</div>';  print '</div>';
301    
302  $db->close();  $db->close();

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26