]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch 'sgmurphy-clone/0.7.x' into 0.7.x
authorEvan Prodromou <evan@controlyourself.ca>
Mon, 9 Feb 2009 17:03:45 +0000 (12:03 -0500)
committerEvan Prodromou <evan@controlyourself.ca>
Mon, 9 Feb 2009 17:03:45 +0000 (12:03 -0500)
actions/showstream.php
lib/imagefile.php

index 28bb8453f8c1111dd04a44b9fcff947273fd146b..6bed700c2d4b374d6926c17533626c6ec5b3c3c4 100644 (file)
@@ -248,6 +248,15 @@ class ShowstreamAction extends Action
                                     'height' => AVATAR_PROFILE_SIZE,
                                     'alt' => $this->profile->nickname));
         $this->elementEnd('dd');
+        
+        $user = User::staticGet('id', $this->profile->id);
+        $cur = common_current_user();
+        if ($cur && $cur->id == $user->id) {
+            $this->elementStart('dd');
+            $this->element('a', array('href' => common_local_url('avatarsettings')), _('Edit Avatar'));
+            $this->elementEnd('dd');
+        }
+        
         $this->elementEnd('dl');
 
         $this->elementStart('dl', 'entity_nickname');
@@ -346,7 +355,6 @@ class ShowstreamAction extends Action
             $this->elementEnd('li');
         }
 
-        $user = User::staticGet('id', $this->profile->id);
         if ($cur && $cur->id != $user->id && $cur->mutuallySubscribed($user)) {
            $this->elementStart('li', 'entity_send-a-message');
             $this->element('a', array('href' => common_local_url('newmessage', array('to' => $user->id)),
index db344db8f83d8500c790210df522de5ab8cf80f6..ea24029a30b2ed8904f99756c006971e538b3086 100644 (file)
@@ -112,6 +112,23 @@ class ImageFile
             throw new Exception(_('Lost our file.'));
             return;
         }
+        
+        // Don't crop/scale if it isn't necessary
+        if ($size === $this->width 
+            && $size === $this->height 
+            && $x === 0 
+            && $y === 0 
+            && $w === $this->width
+            && $h === $this->height) {
+            
+            $outname = Avatar::filename($this->id,
+                                                image_type_to_extension($this->type),
+                                                $size,
+                                                common_timestamp());
+            $outpath = Avatar::path($outname);
+            @copy($this->filepath, $outpath);
+            return $outname;
+        }
 
         switch ($this->type) {
          case IMAGETYPE_GIF:
@@ -165,7 +182,7 @@ class ImageFile
             imagegif($image_dest, $outpath);
             break;
          case IMAGETYPE_JPEG:
-            imagejpeg($image_dest, $outpath);
+            imagejpeg($image_dest, $outpath, 100);
             break;
          case IMAGETYPE_PNG:
             imagepng($image_dest, $outpath);
@@ -174,6 +191,9 @@ class ImageFile
             throw new Exception(_('Unknown file type'));
             return;
         }
+        
+        imagedestroy($image_src);
+        imagedestroy($image_dest);
 
         return $outname;
     }