From c3cf459b278b8eb833d1baa56897cd58f73eadc8 Mon Sep 17 00:00:00 2001 From: Zach Prezkuta Date: Tue, 9 Oct 2012 09:35:32 -0600 Subject: [PATCH 1/3] use getWidth and getHeight, which are agnostic to Imagick being enabled --- include/Photo.php | 64 ++++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/include/Photo.php b/include/Photo.php index 25a2b7080..ec967ac74 100644 --- a/include/Photo.php +++ b/include/Photo.php @@ -129,11 +129,12 @@ class Photo { $this->image->setCompressionQuality($quality); } - $this->width = $this->image->getImageWidth(); + // The 'width' and 'height' properties are only used by non-Imagick routines. + $this->width = $this->image->getImageWidth(); $this->height = $this->image->getImageHeight(); $this->valid = true; - return true; + return true; } $this->valid = false; @@ -205,8 +206,8 @@ class Photo { if(!$this->is_valid()) return FALSE; - $width = $this->width; - $height = $this->height; + $width = $this->getWidth(); + $height = $this->getHeight(); $dest_width = $dest_height = 0; @@ -263,24 +264,25 @@ class Photo { if($this->is_imagick()) { - /** - * If it is not animated, there will be only one iteration here, - * so don't bother checking - */ - // Don't forget to go back to the first frame - $this->image->setFirstIterator(); - do { + /** + * If it is not animated, there will be only one iteration here, + * so don't bother checking + */ + // Don't forget to go back to the first frame + $this->image->setFirstIterator(); + do { // FIXME - implement horizantal bias for scaling as in followin GD functions // to allow very tall images to be constrained only horizontally. - $this->image->scaleImage($dest_width, $dest_height); - } while ($this->image->nextImage()); + $this->image->scaleImage($dest_width, $dest_height); + } while ($this->image->nextImage()); - // FIXME - also we need to copy the new dimensions to $this->height, $this->width as other functions - // may rely on it. + // These may not be necessary any more + $this->width = $this->image->getImageWidth(); + $this->height = $this->image->getImageHeight(); - return; + return; } @@ -402,8 +404,8 @@ class Photo { return FALSE; - $width = $this->width; - $height = $this->height; + $width = $this->getWidth(); + $height = $this->getHeight(); $dest_width = $dest_height = 0; @@ -483,19 +485,19 @@ class Photo { if(!$this->is_valid()) return FALSE; - if($this->is_imagick()) { - $this->image->setFirstIterator(); - do { - $this->image->cropImage($w, $h, $x, $y); - /** - * We need to remove the canva, - * or the image is not resized to the crop: - * http://php.net/manual/en/imagick.cropimage.php#97232 - */ - $this->image->setImagePage(0, 0, 0, 0); - } while ($this->image->nextImage()); - return $this->scaleImage($max); - } + if($this->is_imagick()) { + $this->image->setFirstIterator(); + do { + $this->image->cropImage($w, $h, $x, $y); + /** + * We need to remove the canva, + * or the image is not resized to the crop: + * http://php.net/manual/en/imagick.cropimage.php#97232 + */ + $this->image->setImagePage(0, 0, 0, 0); + } while ($this->image->nextImage()); + return $this->scaleImage($max); + } $dest = imagecreatetruecolor( $max, $max ); imagealphablending($dest, false); From 96a245409b04f32c1610843b0b784ab65981500a Mon Sep 17 00:00:00 2001 From: Zach Prezkuta Date: Tue, 9 Oct 2012 09:45:54 -0600 Subject: [PATCH 2/3] allow changing the lockview content with a plugin --- mod/lockview.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mod/lockview.php b/mod/lockview.php index 0307103f8..0ae54c8c1 100644 --- a/mod/lockview.php +++ b/mod/lockview.php @@ -24,8 +24,13 @@ function lockview_content(&$a) { if(! count($r)) killme(); $item = $r[0]; - if($item['uid'] != local_user()) + + call_hooks('lockview_content', $item); + + if($item['uid'] != local_user()) { + echo t('Remote privacy information not available.') . '
'; killme(); + } if(($item['private'] == 1) && (! strlen($item['allow_cid'])) && (! strlen($item['allow_gid'])) From 86d6f380dcca6f6446d9ab2bc5c3d46bb8db6001 Mon Sep 17 00:00:00 2001 From: Zach Prezkuta Date: Tue, 9 Oct 2012 09:47:14 -0600 Subject: [PATCH 3/3] add home_init hook to manage to call startpage plugin --- mod/manage.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mod/manage.php b/mod/manage.php index 4bc7a3bab..1b8e2f1e2 100644 --- a/mod/manage.php +++ b/mod/manage.php @@ -75,7 +75,10 @@ function manage_post(&$a) { if($limited_id) $_SESSION['submanage'] = $original_id; - goaway($a->get_baseurl(true) . '/profile/' . $a->user['nickname']); + $ret = array(); + call_hooks('home_init',$ret); + + goaway( $a->get_baseurl() . "/profile/" . $a->user['nickname'] ); // NOTREACHED }