-
Website
http://blog.new-bamboo.co.uk -
Original page
http://blog.new-bamboo.co.uk/2007/12/03/super-f-simple-resizing -
Subscribe
All Comments -
Community
-
Top Commenters
-
coupde
1 comment · 1 points
-
TomK32
1 comment · 1 points
-
prateekdayal
1 comment · 1 points
-
andycroll
1 comment · 1 points
-
drnic
1 comment · 6 points
-
-
Popular Threads
max_width = AppConfig.max_logo_width
max_height = AppConfig.max_logo_height
begin
data = value.read
image = GD2::Image.load(data)
image.resize!(image.width > max_width ? max_width : image.width,
image.height > max_height ? max_height : image.height)
rescue
self.errors.add(:avatar, "Invalid data")
return
end
Granted, could be simpler. But it works. ;)
apt-get install imagemagick librmagick-ruby
Yes, because when you do 'apt-get install imagemagick librmagick-ruby' it still doesn't work. Not on my system, anyway.
Anyway, this looks awesome. Someone should add it as a processor for attachment_fu...
It's Sofa King Simple!
Nice utility, I've been using ImageScience with pleasant results, but I'm really looking forward to trying this out. Not only will my code base shrink I can eliminate the _one_ compiled from source application on my servers.
Mak: Ha. I'm using it in a little merb app and it's so much faster than imagemagick. In fact, here ([attachment_pu.rb](http://blog.new-bamboo.co.uk/assets/2007/12/7/attachment_pu.rb)) is the little merb lib which I'm using for attachments. Very simple, S3 and more will be added as time goes on.