[pLog-svn] r4021 - in plog/branches/lifetype-1.1.1/class/gallery:
dao resizers
oscar at devel.lifetype.net
oscar at devel.lifetype.net
Fri Sep 22 21:51:04 GMT 2006
Author: oscar
Date: 2006-09-22 21:51:04 +0000 (Fri, 22 Sep 2006)
New Revision: 4021
Modified:
plog/branches/lifetype-1.1.1/class/gallery/dao/galleryresources.class.php
plog/branches/lifetype-1.1.1/class/gallery/resizers/gallerythumbnailgenerator.class.php
Log:
some more fixes related to issue 1040
Modified: plog/branches/lifetype-1.1.1/class/gallery/dao/galleryresources.class.php
===================================================================
--- plog/branches/lifetype-1.1.1/class/gallery/dao/galleryresources.class.php 2006-09-22 20:02:56 UTC (rev 4020)
+++ plog/branches/lifetype-1.1.1/class/gallery/dao/galleryresources.class.php 2006-09-22 21:51:04 UTC (rev 4021)
@@ -476,23 +476,31 @@
$imgHeight = $info["video"]["resolution_y"];
$previewHeight = $config->getValue( "thumbnail_height", GALLERY_DEFAULT_THUMBNAIL_HEIGHT );
- $previewWidth = $config->getValue( "thumbnail_width", GALLERY_DEFAULT_THUMBNAIL_WIDTH );
- if( $imgHeight > $previewHeight || $imgWidth > $previewWidth ) {
- GalleryThumbnailGenerator::generateResourceThumbnail( $resFile, $resourceId, $ownerId );
- }
+ $previewWidth = $config->getValue( "thumbnail_width", GALLERY_DEFAULT_THUMBNAIL_WIDTH );
+ $imgHeight > $previewHeight ? $previewHeight = GALLERY_DEFAULT_THUMBNAIL_HEIGHT : $previewHeight = $imgHeight;
+ $imgWidth > $previewWidth ? $previewWidth = GALLERY_DEFAULT_THUMBNAIL_HEIGHT : $previewWidth = $imgWidth;
+ GalleryThumbnailGenerator::generateResourceThumbnail( $resFile, $resourceId, $ownerId, $previewHeight, $previewWidth );
$medPreviewHeight = $config->getValue( "medium_size_thumbnail_height", GALLERY_DEFAULT_MEDIUM_SIZE_THUMBNAIL_HEIGHT );
- $medPreviewWidth = $config->getValue( "medium_size_thumbnail_width", GALLERY_DEFAULT_MEDIUM_SIZE_THUMBNAIL_WIDTH );
- if( $imgHeight > $medPreviewHeight || $imgWidth > $medPreviewWidth ) {
- GalleryThumbnailGenerator::generateResourceMediumSizeThumbnail( $resFile, $resourceId, $ownerId );
- }
+ $medPreviewWidth = $config->getValue( "medium_size_thumbnail_width", GALLERY_DEFAULT_MEDIUM_SIZE_THUMBNAIL_WIDTH );
+ $imgHeight > $medPreviewHeight ? $medPreviewHeight = GALLERY_DEFAULT_MEDIUM_SIZE_THUMBNAIL_HEIGHT : $medPreviewHeight = $imgHeight;
+ $imgWidth > $medPreviewWidth ? $medPreviewWidth = GALLERY_DEFAULT_MEDIUM_SIZE_THUMBNAIL_WIDTH : $medPreviewWidth = $imgWidth;
+ GalleryThumbnailGenerator::generateResourceMediumSizeThumbnail( $resFile, $resourceId, $ownerId, $medPreviewHeight, $medPreviewWidth );
// call this method only if the settings are right and the image is bigger than the final size(s)
$finalPreviewHeight = $config->getValue( "final_size_thumbnail_height", 0 );
- $finalPreviewWidth = $config->getValue( "final_size_thumbnail_width", 0 );
- if(($previewHeight != 0 && $previewWidth != 0) &&
- ($imgHeight > $finalPreviewHeight || $imgWidth > $finalPreviewWidth )) {
- GalleryThumbnailGenerator::generateResourceFinalSizeThumbnail( $resFile, $resourceId, $ownerId );
+ $finalPreviewWidth = $config->getValue( "final_size_thumbnail_width", 0 );
+
+ if( $finalPreviewHeight > 0 )
+ if( $imgHeight < $finalPreviewHeight )
+ $finalPreviewHeight = $imgHeight;
+
+ if( $finalPreviewWidth > 0 )
+ if( $imgWidth < $finalPreviewWidth )
+ $finalPreviewWidth = $imgWidth;
+
+ if( $finalPreviewHeight != 0 && $finalPreviewWidth != 0 ) {
+ GalleryThumbnailGenerator::generateResourceFinalSizeThumbnail( $resFile, $resourceId, $ownerId, $finalPreviewHeight, $finalPreviewWidth );
// we have to recalculate the metadata because the image could be different... This is a bit cumbersome
// and repeats code. We know, thanks.
$getId3 = new GetID3();
Modified: plog/branches/lifetype-1.1.1/class/gallery/resizers/gallerythumbnailgenerator.class.php
===================================================================
--- plog/branches/lifetype-1.1.1/class/gallery/resizers/gallerythumbnailgenerator.class.php 2006-09-22 20:02:56 UTC (rev 4020)
+++ plog/branches/lifetype-1.1.1/class/gallery/resizers/gallerythumbnailgenerator.class.php 2006-09-22 21:51:04 UTC (rev 4021)
@@ -2,23 +2,25 @@
class GalleryThumbnailGenerator
{
-
+
/**
* generates the thumbnail of a file that we have just added.
*
* @param resFile the resource file from which we're trying to generate the
* thubmail.
* @param fileName The name and path of the new thumbnail we're going to create
+ * @param previewHeight
+ * @param previewWidth
* @static
*/
- function generateResourceThumbnail( $resFile, $resourceId, $ownerId )
+ function generateResourceThumbnail( $resFile, $resourceId, $ownerId,
+ $previewHeight = GALLERY_DEFAULT_MEDIUM_SIZE_THUMBNAIL_HEIGHT,
+ $previewWidth = GALLERY_DEFAULT_MEDIUM_SIZE_THUMBNAIL_WIDTH )
{
// get some configuration settings regarding the size of the
// thumbnails, and also the default format for thumbnails
include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
$config =& Config::getConfig();
- $previewHeight = $config->getValue( "thumbnail_height", GALLERY_DEFAULT_THUMBNAIL_HEIGHT );
- $previewWidth = $config->getValue( "thumbnail_width", GALLERY_DEFAULT_THUMBNAIL_WIDTH );
$previewKeepAspectRatio = $config->getValue( "thumbnails_keep_aspect_ratio" );
// get the file extension
@@ -45,18 +47,20 @@
* @param resFile the resource file from which we're trying to generate the
* thubmail.
* @param fileName The name and path of the new thumbnail we're going to create
+ * @param previewHeight
+ * @param previewWidth
* @static
*/
- function generateResourceMediumSizeThumbnail( $resFile, $resourceId, $ownerId )
+ function generateResourceMediumSizeThumbnail( $resFile, $resourceId, $ownerId,
+ $previewHeight = GALLERY_DEFAULT_MEDIUM_SIZE_THUMBNAIL_HEIGHT,
+ $previewWidth = GALLERY_DEFAULT_MEDIUM_SIZE_THUMBNAIL_WIDTH )
{
// get some configuration settings regarding the size of the
// thumbnails, and also the default format for thumbnails
include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
$config =& Config::getConfig();
- $previewHeight = $config->getValue( "medium_size_thumbnail_height", GALLERY_DEFAULT_MEDIUM_SIZE_THUMBNAIL_HEIGHT );
- $previewWidth = $config->getValue( "medium_size_thumbnail_width", GALLERY_DEFAULT_MEDIUM_SIZE_THUMBNAIL_WIDTH );
$previewKeepAspectRatio = $config->getValue( "thumbnails_keep_aspect_ratio" );
-
+
// get the file extension
$fileParts = explode( ".", $resFile );
$fileExt = strtolower($fileParts[count($fileParts)-1]);
@@ -81,18 +85,24 @@
* @param resFile the resource file from which we're trying to generate the
* thubmail.
* @param fileName The name and path of the new thumbnail we're going to create
+ * @param previewHeight
+ * @param previewWidth
+ *
* @static
*/
- function generateResourceFinalSizeThumbnail( $resFile, $resourceId, $ownerId )
+ function generateResourceFinalSizeThumbnail( $resFile, $resourceId, $ownerId,
+ $previewHeight = 0,
+ $previewWidth = 0 )
+
{
// get some configuration settings regarding the size of the
// thumbnails, and also the default format for thumbnails
include_once( PLOG_CLASS_PATH."class/config/config.class.php" );
$config =& Config::getConfig();
- $previewHeight = $config->getValue( "final_size_thumbnail_height", 0 );
- $previewWidth = $config->getValue( "final_size_thumbnail_width", 0 );
$previewKeepAspectRatio = $config->getValue( "thumbnails_keep_aspect_ratio" );
+ print("final height = $previewHeight - final width = $previewWidth" );
+
// get the file extension
$fileParts = explode( ".", $resFile );
$fileExt = $fileParts[count($fileParts)-1];
More information about the pLog-svn
mailing list