Good news to all posters
Now when you submit your photo or audio you automatically give it a star. It just makes sense. Why wouldn’t you like your own photo?
Thanks for the input Dean!
Now when you submit your photo or audio you automatically give it a star. It just makes sense. Why wouldn’t you like your own photo?
Thanks for the input Dean!
Since attachment_fu doesn’t support RMagick cropping, all of our thumbnails for avatars and photos were scaled funny and I had to rely on CSS to fix the issue (setting the overflow to hidden).
This seemed more like a strange hack and isn’t how I wanted the final thumbnailing to be. I knew as soon as we were ready, it would only take some Googling to find someone who fixed this problem.
Jon Dahl posted a solution:
module Technoweenie # :nodoc:
module AttachmentFu # :nodoc:
module Processors
module RmagickProcessor
protected :resize_image
def resize_image(img, size)
size = size.first if size.is_a?(Array) && size.length == 1 && !size.first.is_a?(Fixnum)
if size.is_a?(Fixnum) || (size.is_a?(Array) && size.first.is_a?(Fixnum))
size = [size, size] if size.is_a?(Fixnum)
img.crop_resized!(*size)
else
img.change_geometry(size.to_s) { |cols, rows, image| image.crop_resized!(cols, rows) }
end
self.temp_path = write_to_temp_file(img.to_blob)
end
end
end
end
end
Just add this code to the bottom of your attachment model (the one where you put has_attachment), or within a file in your lib/ directory. It changes the resizing methods from img.thumbnail!(size) to img.crop_resized!(size) - that’s it.
Thanks for the help, Jon… ReBlogged!