I use carrierwave and would like to have GD2 process the images (cropping / resizing). ImageMagick and RMagic are good functionality wise but are to resource heavy.
I have searched around but was not able to find any good leads. I appreciate any suggestions.
Related
I want to upload some images and crop that without losing their quality in ruby on rails.For uploading images i have seen gems like paperclip,refile and CarrierWave.Which one will be better ?
Choosing between CarrierWave, Paperclip and Refile can be difficult at
times, but I would always recommend CarrierWave. It is the most
powerful and customizable of the three. It keeps your code organized
and clean, and is easy to test.
Refile isn't ready for prime time yet as it is still experiencing
growth pains and has DoS issues, and Paperclip is fairly simplistic.
For more information please see this acrticle: Best Rails image uploader - Paperclip vs. Carrierwave vs. Refile
In Rails, while using the carrierwave gem, can we optimize images that are being uploaded? Optimize means compress and shrink the file size?
Yes, it is possible. You should write own image processor and use ImageMagick or MiniMagick command to optimize images as you wish.
For example here is article about optimization of images with MiniMagick.
The second way is related to using such gems as carrierwave-imageoptimizer it provide image optimization out of the box.
I am interested in building a Rails based system for handling the display and organization of large amounts of photos. This is sort of like Flickr but smaller. Each photo will have metadata associated with it. Photos will be shown in a selectable list and grid view. It would be nice to be able to load images as they are needed as well (as this would probably speed things up).
At the moment I have a test version of my database working by images loading from the assets/images directory but it is beginning to run slow when displaying several images (200-600 images). This is due to the way I have my view setup. I am using a straight loop to display the images in both list and grid layouts.
I also manually resized the thumbnails and a medium sized image from a full sized source image. I am investigating other resizing methods. Any advice is appreciated here as well.
As I am new to handling the images this way, could someone point me in a direction based on experience designing and implementing something like Flickr?
I am investigating the following tools:
Paperclip
http://railscasts.com/episodes/134-paperclip
Requirements: ImageMajick
attachment_fu
http://clarkware.com/blog/2007/02/24/file-upload-fu#FileUploadFu
Requirement: One of the following: ImageScience, RMagick, miniMagick, ImageMajick?
CarrierWave
http://cloudinary.com/blog/ruby_on_rails_image_uploads_with_carrierwave_and_cloudinary
http://cloudinary.com/blog/advanced_image_transformations_in_the_cloud_with_carrierwave_cloudinary
I'd go with Carrierwave anyday. It is very flexible and has lot of useful strategies. It generates it's on Uploader class and has all nifty and self explanatory features such as automatic generation of thumbnails (as specified by you), blacklisting, formatting image, size constraints etc; which you can put to your use.
This Railscast by Ryan Bates - http://railscasts.com/episodes/253-carrierwave-file-uploads is very useful, if you haven't seen it already.
Paperclip and CarrierWave are totally appropriate tools for the job, and the one you choose is going to be a matter of personal preference. They both have tons of users and active, ongoing development. The difference is whether you'd prefer to define your file upload rules in a separate class (CarrierWave), or if you'd rather define them inline in your model (Paperclip).
I prefer CarrierWave, but based on usage it's clear plenty of people feel otherwise.
Note that neither gem is going to do anything for your slow view with 200-600 images. These gems are just for handling image uploads, and don't help you with anything beyond that.
Note also that Rails is really pretty bad at handling file uploads and file downloads, and you should avoid this where possible by letting other services (a cdn, your web server, s3, etc) handle these for you. The central gotcha is that if you handle a file transfer with rails, your entire web application process is busy for the duration of the transfer. (For related discussion on this topic, see: Best Ruby on Rails Architecture for Image Heavy App).
I've seen a lot of good example applications using the carrierwave gem for image uploading. I've not seen any for video uploading.
Can anyone share an example / demo Rails application using carrierwave and the ffmpeg gem (streemio-ffmpeg) or another video processing gem?
Thanks for sharing.
Answering my own question here, I would still really like to see some examples if anyone else cares to contribute. In the mean time there's these two:
https://github.com/zencoder/dreamlive (by Zencoder guys, a heroku app)
http://www.nickdesteffen.com/blog/video-encoding-with-uploadify-carrierwave-and-zencoder (uses uploadify [flash - argh...] but still useful overall. Found a couple of things have had to be changed as time has gone by but a lot of info is in there.)
Both are quite useful but not ideal. They use Zencoder which is not a video processing gem - it's just helps with the Zencoder API. Zencoder is a paid-for product by the people behind rVideo, one of the more comprehensive gems I noticed when on my ffmpeg hunt.
In then end I've decided that the cost of Zencoder is inconvenient but not as inconvenient as my server going down etc if I were to badly integrate my own in house video processing. I'm accepting this answer but it's not the best.
Google's app engine has this speedy image resizing api which appears to perform significantly faster than the rails paperclip resizing alternative.
Anyone know of any rails/heroku friend image resizing api's that could work with paperclip to be a faster resizing solution?
Thanks
We've used Transloadit and it works well:
http://transloadit.com/
When you do images on heroku, you're usually storing them up on S3.
You can upload the file directly to S3, then use delayed job to process the file in the background. Your users will see a zippier/faster processing time.
Paperclip itself doesn't include image-resizing code; it simply plugs into tools like ImageMagick and MiniMagick. Have you tried some of these other engines?