[ 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/ -> gallerythumbnailgenerator.class.php (source)

   1  <?php    
   2      
   3      class GalleryThumbnailGenerator 
   4      {
   5          
   6          /**
   7           * generates the thumbnail of a file that we have just added.
   8           *
   9           * @param resFile the resource file from which we're trying to generate the
  10           * thubmail.
  11           * @param fileName The name and path of the new thumbnail we're going to create
  12           * @param previewHeight
  13           * @param previewWidth        
  14           * @static
  15           */
  16  		function generateResourceThumbnail( $resFile, $resourceId, $ownerId,
  17                                              $previewHeight = GALLERY_DEFAULT_THUMBNAIL_HEIGHT,
  18                                              $previewWidth = GALLERY_DEFAULT_THUMBNAIL_WIDTH )    
  19          {
  20              // get some configuration settings regarding the size of the
  21              // thumbnails, and also the default format for thumbnails
  22              lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );            
  23              $config =& Config::getConfig();
  24              $previewKeepAspectRatio = $config->getValue( "thumbnails_keep_aspect_ratio" );
  25              
  26              // and start the resizing process
  27              lt_include( PLOG_CLASS_PATH."class/gallery/resizers/galleryresizer.class.php" );            
  28              $resizer = new GalleryResizer( $resFile );
  29              lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );            
  30              GalleryResourceStorage::checkPreviewsStorageFolder( $ownerId );
  31              lt_include( PLOG_CLASS_PATH."class/file/file.class.php" );
  32              $outFile = GalleryResourceStorage::getPreviewsFolder( $ownerId ).File::basename($resFile);
  33              
  34              // and finally, we can generate the preview!
  35              $result = $resizer->generate( $outFile, $previewHeight, $previewWidth, $previewKeepAspectRatio );
  36              
  37              return $result;
  38          }
  39          
  40          /**
  41           * generates the medium-sized thumbnail of a file that we have just added
  42           *
  43           * @param resFile the resource file from which we're trying to generate the
  44           * thubmail.
  45           * @param fileName The name and path of the new thumbnail we're going to create
  46           * @param previewHeight
  47           * @param previewWidth        
  48           * @static
  49           */
  50  		function generateResourceMediumSizeThumbnail( $resFile, $resourceId, $ownerId, 
  51                                                        $previewHeight = GALLERY_DEFAULT_MEDIUM_SIZE_THUMBNAIL_HEIGHT,                
  52                                                        $previewWidth = GALLERY_DEFAULT_MEDIUM_SIZE_THUMBNAIL_WIDTH )
  53          {
  54              // get some configuration settings regarding the size of the
  55              // thumbnails, and also the default format for thumbnails
  56              lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );            
  57              $config =& Config::getConfig();
  58              $previewKeepAspectRatio = $config->getValue( "thumbnails_keep_aspect_ratio" );
  59                          
  60              // and start the resizing process
  61              lt_include( PLOG_CLASS_PATH."class/gallery/resizers/galleryresizer.class.php" );            
  62              $resizer = new GalleryResizer( $resFile );
  63              lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );            
  64              GalleryResourceStorage::checkMediumSizePreviewsStorageFolder( $ownerId );
  65              lt_include( PLOG_CLASS_PATH."class/file/file.class.php" );
  66              $outFile = GalleryResourceStorage::getMediumSizePreviewsFolder( $ownerId ).File::basename( $resFile );
  67              
  68              // and finally, we can generate the preview!
  69              $result = $resizer->generate( $outFile, $previewWidth, $previewHeight, $previewKeepAspectRatio );
  70              
  71              return $result;
  72          }
  73          
  74          /**
  75           * generates the final version of an image
  76           *
  77           * @param resFile the resource file from which we're trying to generate the
  78           * thubmail.
  79           * @param fileName The name and path of the new thumbnail we're going to create
  80           * @param previewHeight
  81           * @param previewWidth
  82           * 
  83           * @static
  84           */
  85  		function generateResourceFinalSizeThumbnail( $resFile, $resourceId, $ownerId,
  86                                                          $previewHeight = 0,                
  87                                                       $previewWidth = 0 )
  88              
  89          {
  90              // get some configuration settings regarding the size of the
  91              // thumbnails, and also the default format for thumbnails
  92              lt_include( PLOG_CLASS_PATH."class/config/config.class.php" );            
  93              $config =& Config::getConfig();
  94              $previewKeepAspectRatio = $config->getValue( "thumbnails_keep_aspect_ratio" );
  95  
  96              // and start the resizing process
  97              lt_include( PLOG_CLASS_PATH."class/gallery/resizers/galleryresizer.class.php" );            
  98              $resizer = new GalleryResizer( $resFile );
  99              lt_include( PLOG_CLASS_PATH."class/gallery/dao/galleryresourcestorage.class.php" );            
 100              GalleryResourceStorage::checkUserStorageFolder( $ownerId );
 101              lt_include( PLOG_CLASS_PATH."class/file/file.class.php" );
 102              $outFile = GalleryResourceStorage::getUserFolder( $ownerId ).File::basename( $resFile );
 103              
 104              // and finally, we can generate the preview!
 105              $result = $resizer->generate( $outFile, $previewWidth, $previewHeight, $previewKeepAspectRatio );
 106              
 107              return $result;
 108          }                
 109      }
 110  ?>


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