Tadashi Okoshi
slash****@users*****
2005年 12月 17日 (土) 02:29:00 JST
Index: affelio/lib/Affelio/App/Admin/EditProfile.pm
diff -u affelio/lib/Affelio/App/Admin/EditProfile.pm:1.6 affelio/lib/Affelio/App/Admin/EditProfile.pm:1.7
--- affelio/lib/Affelio/App/Admin/EditProfile.pm:1.6 Wed Nov 23 13:00:19 2005
+++ affelio/lib/Affelio/App/Admin/EditProfile.pm Sat Dec 17 02:29:00 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.6 2005/11/23 04:00:19 slash5234 Exp $
+# $Id: EditProfile.pm,v 1.7 2005/12/16 17:29:00 slash5234 Exp $
package Affelio::App::Admin::EditProfile;
{
@@ -68,6 +68,51 @@
print OUT $buffer;
}
close OUT;
+
+ ###################################################
+ #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);
+
+ print "Content-type: image/jpeg\n\n";
+ binmode STDOUT;
+ $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);
+
+ print "Content-type: image/jpeg\n\n";
+ binmode STDOUT;
+ $image->Write("$af->{site__user_dir}/profile_face_150x150.jpg");
+ }
+
}
}catch Error with{
my $e = shift;