[Affelio-cvs 897] CVS update: affelio/lib/Affelio/App/Admin

Back to archive index

Tadashi Okoshi slash****@users*****
2005年 12月 17日 (土) 13:45:14 JST


Index: affelio/lib/Affelio/App/Admin/EditProfile.pm
diff -u affelio/lib/Affelio/App/Admin/EditProfile.pm:1.8 affelio/lib/Affelio/App/Admin/EditProfile.pm:1.9
--- affelio/lib/Affelio/App/Admin/EditProfile.pm:1.8	Sat Dec 17 02:35:26 2005
+++ affelio/lib/Affelio/App/Admin/EditProfile.pm	Sat Dec 17 13:45:14 2005
@@ -14,7 +14,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #
-# $Id: EditProfile.pm,v 1.8 2005/12/16 17:35:26 slash5234 Exp $
+# $Id: EditProfile.pm,v 1.9 2005/12/17 04:45:14 slash5234 Exp $
 
 package Affelio::App::Admin::EditProfile;
 {
@@ -72,41 +72,14 @@
 		###################################################
 		#Prepare resized images
 		###################################################
-		use Image::Magick;
-		{
-		    my $image = Image::Magick->new;
-		    $image->Read("$af->{site__user_dir}/profile_face.jpg");
-		    my ($width, $height) = $image->Get('width', 'height');
-		    
-		    if($width >= $height){
-			my $scale = 100 / $width;
-			$height = $height * $scale;
-			$width=100;
-		    }else{
-			my $scale = 100 / $height;
-			$width = $width * $scale;
-			$height=100;
-		    }
-		    $image->Resize(width=>$width, height=>$height, blur=>0.6);
-		    $image->Write("$af->{site__user_dir}/profile_face_100x100.jpg");
-		}
-		{
-		    my $image = Image::Magick->new;
-		    $image->Read("$af->{site__user_dir}/profile_face.jpg");
-		    my ($width, $height) = $image->Get('width', 'height');
-		    if($width >= $height){
-			my $scale = 150 / $width;
-			$height = $height * $scale;
-			$width=150;
-		    }else{
-			my $scale = 150 / $height;
-			$width = $width * $scale;
-			$height=150;
-		    }
-		    $image->Resize(width=>$width, height=>$height, blur=>0.6);
-		    $image->Write("$af->{site__user_dir}/profile_face_150x150.jpg");
-		}
-
+		use Affelio::misc::ImageEditor qw(resize_image);
+		resize_image("$af->{site__user_dir}/profile_face.jpg",
+			     "$af->{site__user_dir}/profile_face_100x100.jpg",
+			     100);
+
+		resize_image("$af->{site__user_dir}/profile_face.jpg",
+			     "$af->{site__user_dir}/profile_face_150x150.jpg",
+			     150);
 	    }		
 	}catch Error with{
 	    my $e = shift;


Affelio-cvs メーリングリストの案内
Back to archive index