[pLog-svn] r3982 - in plog/branches/lifetype-1.1.1/class/gallery: dao resizers

Oscar Renalias oscar at renalias.net
Mon Sep 18 13:07:31 GMT 2006


I don't understand, that line wasn't changed in the patch.

Were you by any chance trying to update a file?

On 9/18/06, BalearWeb <balearweb at balearweb.com> wrote:
> I updated this three files and got
> Fatal error: Call to a member function on a non-object in
> /home/sites/bloc.balearweb.net/web/class/gallery/dao/galleryresources.class.php
> on line 732
> So I updated again back to revision 3942 and everything is ok
>
> Elena
>
> oscar at devel.lifetype.net wrote:
>  > Author: oscar
>  > Date: 2006-09-17 22:16:01 +0000 (Sun, 17 Sep 2006)
>  > New Revision: 3982
>  >
>  > Modified:
>  >
> plog/branches/lifetype-1.1.1/class/gallery/dao/galleryresources.class.php
>  >
> plog/branches/lifetype-1.1.1/class/gallery/resizers/galleryabstractresizer.class.php
>  >
> plog/branches/lifetype-1.1.1/class/gallery/resizers/galleryresizer.class.php
>  > Log:
>  > This should fix mantis issue 1040
> (http://bugs.lifetype.net/view.php?id=1040) -- Resizing of uploaded
> images works also on smaller images, where images smaller than the final
> size (if a final size for images was set) would be resized up to this
> final size
>  >
>  >
>  > 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-17 21:18:24 UTC (rev 3981)
>  > +++
> plog/branches/lifetype-1.1.1/class/gallery/dao/galleryresources.class.php
>  2006-09-17 22:16:01 UTC (rev 3982)
>  > @@ -439,7 +439,7 @@
>  >              if( $resourceType == GALLERY_RESOURCE_IMAGE )
>  >                  $flags = $flags|GALLERY_RESOURCE_PREVIEW_AVAILABLE;
>  >
>  > -            $info = $this->_filterMetadata( $metadata, $resourceType
> );
>  > +            $info = $this->_filterMetadata( $metadata, $resourceType
> );
>  >
>  >              // add the record to the database
>  >              $fileName = $upload->getFileName();
>  > @@ -467,15 +467,31 @@
>  >
>  >              // and finally, we can generate the thumbnail only if
> the file is an image, of course :)
>  >              if( $resourceType == GALLERY_RESOURCE_IMAGE ) {
>  > -                include_once(
> PLOG_CLASS_PATH."class/gallery/resizers/gallerythumbnailgenerator.class.php"
> );
>  > -
> GalleryThumbnailGenerator::generateResourceThumbnail( $resFile,
> $resourceId, $ownerId );
>  > -
>  GalleryThumbnailGenerator::generateResourceMediumSizeThumbnail(
> $resFile, $resourceId, $ownerId );
>  > -                // call this method only if the settings are right
>  > +                include_once(
> PLOG_CLASS_PATH."class/gallery/resizers/gallerythumbnailgenerator.class.php"
> );
>  > +
>  >                  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 );
>  > -                if( $previewHeight != 0 && $previewWidth != 0 ) {
>  > +                $config =& Config::getConfig();
>
>  > +
>  > +                $imgWidth = $info["video"]["resolution_x"];
>  > +                $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 );
>  > +                }
>  > +
>  > +                $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 );
>  > +                }
>  > +
>  > +                // 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 );
>  >                      // we have to recalculate the metadata because
> the image could be different... This is a bit cumbersome
>  >                      // and repeats code. We know, thanks.
>  >
>  > Modified:
> plog/branches/lifetype-1.1.1/class/gallery/resizers/galleryabstractresizer.class.php
>  > ===================================================================
>  > ---
> plog/branches/lifetype-1.1.1/class/gallery/resizers/galleryabstractresizer.class.php
>  2006-09-17 21:18:24 UTC (rev 3981)
>  > +++
> plog/branches/lifetype-1.1.1/class/gallery/resizers/galleryabstractresizer.class.php
>  2006-09-17 22:16:01 UTC (rev 3982)
>  > @@ -9,24 +9,35 @@
>  >       * the skeleton of the functions that should be implemented by
> the generators
>  >       * themselves.
>  >       */
>  > -    class GalleryAbstractResizer
>  > +    class GalleryAbstractResizer
>  >      {
>  >
>  >          var $_image;
>  >          var $_outputMethod;
>  > +        var $_keepAspectRatio;
>  >
>  >          /**
>  >           * Constructor.
>  >           *
>  >           */
>  >          function GalleryAbstractResizer( $image, $outputMethod )
>  > -        {
>  > -
>  > -
>  > +        {
>  >              $this->_image  = $image;
>  >              $this->_outputMethod = $outputMethod;
>  > +            $this->_keepAspectRatio = true;
>  >          }
>  >
>  > +        /**
>  > +         * Informs the resizer to keep the aspect ratio of the image
> when resizing, although
>  > +         * this value may be ignored by the resizer and it depends
> on the implementation.
>  > +         *
>  > +         * @param keepAspectRatio Whether to keep the aspect ratio
>  > +         */
>  > +        function setKeepAspectRatio( $keepAspectRatio )
>  > +        {
>  > +            $this->_keepAspectRatio = $keepAspectRatio;
>  > +        }
>  > +
>  >          /**
>  >           * Generates the thumbnail
>  >           * Uses the values set in the constructor regarding the
> width, height and output format
>  >
>  > Modified:
> plog/branches/lifetype-1.1.1/class/gallery/resizers/galleryresizer.class.php
>  > ===================================================================
>  > ---
> plog/branches/lifetype-1.1.1/class/gallery/resizers/galleryresizer.class.php
>  2006-09-17 21:18:24 UTC (rev 3981)
>  > +++
> plog/branches/lifetype-1.1.1/class/gallery/resizers/galleryresizer.class.php
>  2006-09-17 22:16:01 UTC (rev 3982)
>  > @@ -106,7 +106,7 @@
>  >              $config =& Config::getConfig();
>  >              return $config->getValue( "thumbnail_format" );
>  >          }
>  > -
>  > +
>  >          /**
>  >           * Generates a thumbnail.
>  >           *
>  > @@ -140,6 +140,7 @@
>  >                  $outFile = $fileNoExt.".".$this->_defaultOutputFormat;
>  >              }
>  >
>  > +            $generatorClassObject->setKeepAspectRatio(
> $keepAspectRatio );
>  >              $imgThumb = $generatorClassObject->generate( $outFile,
> $width, $height );
>  >
>  >              return $imgThumb;
>  >
>  > _______________________________________________
>  > pLog-svn mailing list
>  > pLog-svn at devel.lifetype.net
>  > http://devel.lifetype.net/mailman/listinfo/plog-svn
>  >
>  > __________ Informaci�n de NOD32, revisi�n 1.1759 (20060916) __________
>  >
>  > Este mensaje ha sido analizado con  NOD32 antivirus system
>  > http://www.nod32.com
>  >
>  >
>  >
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn
>


More information about the pLog-svn mailing list