[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/gallery/resizers/ -> galleryimagemagickresizer.class.php (source)

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/gallery/resizers/galleryabstractresizer.class.php" );
   4      lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );
   5      
   6      define( "DEFAULT_PATH_TO_CONVERT", "/usr/bin/convert" );
   7  
   8      /**
   9       *
  10       * \ingroup Gallery_resizer
  11       *
  12       * Back end class for generating thumbnails with ImageMagick. It requires the tool
  13       * 'convert' to be installed somewhere in the filesystem. The exact location is determined
  14       * via the config setting "path_to_convert", but it will default to <b>/usr/bin/convert</b>
  15       * if the setting does not exist.
  16       */
  17      class GalleryImageMagickResizer extends GalleryAbstractResizer 
  18      {
  19  
  20          /**
  21           * Constructor.
  22           */
  23      	function GalleryImageMagickResizer( $image, $outputMethod )
  24          {
  25              $this->GalleryAbstractResizer( $image, $outputMethod );
  26          }
  27  
  28          /**
  29           * @see GalleryResizer::generate
  30           */
  31          function generate( $outFile, $width, $height )
  32          {
  33              // get the path to the convert tool
  34              $config =& Config::getConfig();
  35              $convertPath = $config->getValue( "path_to_convert", DEFAULT_PATH_TO_CONVERT );
  36                  // run the command
  37              $command = $convertPath." -geometry ".$width."x".$height." \"".$this->_image."\" \"".$outFile."\"";
  38  
  39              $cmdOutput = system($command, $retval);
  40  
  41                  // check if there was an error creating the thubmnail
  42              if($cmdOutput === FALSE || $retval )
  43                  return false;
  44  
  45                  // depending on the default file creation settings in some hosts, files created via
  46                  // ImageMagick may not be readable by the web server
  47              File::chMod( $outFile, 0644 );
  48              
  49              return $outFile;
  50          }
  51      }
  52  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics