]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'merge-requests/29' into social-master
authorRoland Haeder <roland@mxchange.org>
Sun, 18 Jan 2015 13:08:57 +0000 (14:08 +0100)
committerRoland Haeder <roland@mxchange.org>
Sun, 18 Jan 2015 13:09:00 +0000 (14:09 +0100)
Signed-off-by: Roland Haeder <roland@mxchange.org>
classes/File.php
lib/imagefile.php
plugins/ModPlus/ModPlusPlugin.php
plugins/SearchSub/classes/SearchSub.php
plugins/TagSub/classes/TagSub.php

index 3bbdcbe99069d2fcd2a4b013066ca1460ebd6b11..9bb22e502b6203297980c2c93769b357954820fa 100644 (file)
@@ -391,17 +391,20 @@ class File extends Managed_DataObject
             throw new UnsupportedMediaException('No image geometry available.');
         }
 
-        if ($width === null) {
+        if ($width === null || $width < 1) {
             $width = common_config('thumbnail', 'width');
             $height = common_config('thumbnail', 'height');
             $crop = common_config('thumbnail', 'crop');
         }
 
-        if ($height === null) {
+        if ($height === null || $height < 1) {
             $height = $width;
             $crop = true;
         }
 
+        // Debug log (convert crop to int to have TRUE being displayed as 1 and FALSE as 0)
+        common_debug('[' . __METHOD__ . ':' . __LINE__ . ']: width=' . $width . ',height=' . $height . ',crop=' . intval($crop));
+
         // Get proper aspect ratio width and height before lookup
         // We have to do it through an ImageFile object because of orientation etc.
         // Only other solution would've been to rotate + rewrite uploaded files.
@@ -433,7 +436,19 @@ class File extends Managed_DataObject
                 || $box['h'] < 1 || $box['y'] >= $this->height) {
             // Fail on bad width parameter. If this occurs, it's due to algorithm in ImageFile->scaleToFit
             common_debug("Boundary box parameters for resize of {$this->filepath} : ".var_export($box,true));
-            throw new ServerException('Bad thumbnail size parameters.');
+            throw new ServerException('Bad thumbnail size parameters. maxsize=' .
+                common_config('thumbnail', 'maxsize') .
+                ',box[width]=' . $box['width'] .
+                ',box[height]=' . $box['height'] .
+                ',box[w]=' . $box['w'] .
+                ',box[h]=' . $box['h'] .
+                ',box[x]=' . $box['x'] .
+                ',box[y]=' . $box['y'] .
+                ',this->width=' . $this->width .
+                ',this->heigh=' . $this->height .
+                ',this->filepath=' . $this->filepath .
+                ',this->filename=' . $this->filename
+            );
         }
 
         // Perform resize and store into file
index 733a4bbc9c0d456d61350a6cd4671315f7758f6d..d1614f47b041773bf4b262ef9204b580babf2fde 100644 (file)
@@ -345,6 +345,9 @@ class ImageFile
             throw new Exception(_('Unknown file type'));
         }
 
+        // Always chmod 0644 to have other processes (e.g. queue daemon read it)
+        @chmod($outpath, 0644);
+
         imagedestroy($image_src);
         imagedestroy($image_dest);
     }
index 8433f2737b920d250b8a10785d47f756fdd6176a..3f029ba90958feb5c0b4fc0814e2b0971583306a 100644 (file)
@@ -94,7 +94,7 @@ class ModPlusPlugin extends Plugin
      *
      * @param ProfileListItem $item
      */
-    function onStartProfileListItemProfile($item)
+    function onStartProfileListItemProfile(ProfileListItem $item)
     {
         $this->showProfileOptions($item->out, $item->profile->getProfile());
         return true;
index f3a44854b2730ed81870152772c5f73bea8cac32..0d5828695b18217b6ddcdaaddc3af168972def70 100644 (file)
@@ -91,6 +91,18 @@ class SearchSub extends Managed_DataObject
         return $ts;
     }
 
+    /**
+     * Getter for Profile instance
+     *
+     * @return $profile        Profile instance
+     */
+    public function getProfile () {
+        assert($this->profile_id > 0);
+        $profile = new Profile();
+        $profile->id = $this->profile_id;
+        return $profile;
+    }
+
     /**
      * End a search subscription!
      *
index 5bc0c436ee8f7d3639d273896c98ae4436b81545..43c573e7cbb58258dd97253ed8b2da1db3b70841 100644 (file)
@@ -132,4 +132,16 @@ class TagSub extends Managed_DataObject
 
         return $tags;
     }
+
+    /**
+     * Getter for Profile instance
+     *
+     * @return $profile        Profile instance
+     */
+    public function getProfile () {
+        assert($this->profile_id > 0);
+        $profile = new Profile();
+        $profile->id = $this->profile_id;
+        return $profile;
+    }
 }