Last active
August 29, 2015 14:07
-
-
Save sharpmachine/178778cfb6d536dfa40d to your computer and use it in GitHub Desktop.
Capture screenshot and store it to Amazon s3 - via Carrierwave, Fog and Phantomjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Model < ActiveRecord::Base | |
| before_save :website_screenshot | |
| mount_uploader :screenshot, ScreenshotUploader | |
| def website_screenshot | |
| file = 'app/assets/images/website_screenshot.png' | |
| system 'phantomjs app/assets/javascripts/vendors/rasterize.js ' + website + ' ' + file | |
| self.screenshot = File.open(File.join(Rails.root, file)) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment