sub img_resizing { my (%args) = @_; my $file_name = $args{ file_name } || ''; my $img_location = $args{ img_location } || ''; my $info = image_info("$img_location/$file_name"); my $extension = $info->{file_ext}; #warn Dumper $info; my $oImageMagick = Image::Magick->new; $oImageMagick->Read("$img_location/$file_name"); my $img_width = $oImageMagick->Get('columns'); my $img_height = $oImageMagick->Get('rows'); my $longest = $img_width >= $img_height ? $img_width : $img_height; my $ratio_main = 640 / $longest; $oImageMagick->Resize( width => $img_width * $ratio_main, height => $img_height * $ratio_main ); $oImageMagick->Write("$img_location/$file_name"); my $ratio_thumb = 384 / $longest; $oImageMagick->Resize( width => $img_width * $ratio_thumb, height => $img_height * $ratio_thumb ); $oImageMagick->Write("$img_location/thumbs/$file_name"); } # End Sub img_resizing