问题
I have a Rails app that I want to capture a screenshot of a webpage when the user enters a url.
Is it possible to do this in Rails (is there any gem that would do this?)
If not, are there any reliable services that generate live screenshots
回答1:
I use IMGKit gem for that: https://github.com/csquared/IMGKit
Related topic: How to respond_to PNG or JPG in Rails and generate image from HTML?
回答2:
ScreenCap gem which uses PhantomJS under the hood. Grab whole pages or just specific divs, or even exact x y coordinates.
回答3:
I have used GrabzIt for this. This is quite simple.
来源:https://stackoverflow.com/questions/5647632/capture-screenshots-for-a-ruby-on-rails-application