Class: Image
- Inherits:
-
CommitPhoto
- Object
- CommitPhoto
- Image
- Defined in:
- lib/commitphotos/image.rb
Constant Summary
Constants inherited from CommitPhoto
Instance Method Summary collapse
-
#initialize ⇒ Image
constructor
A new instance of Image.
Methods inherited from CommitPhoto
Constructor Details
#initialize ⇒ Image
Returns a new instance of Image.
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/commitphotos/image.rb', line 2 def initialize tempfile = Tempfile.new(Time.now.to_i.to_s) file = tempfile.path `#{dir}/imagesnap -w 2 -q #{file}` begin image = MiniMagick::Image.open file image.resize '800x800>' image.write file post(File.open file) rescue => e abort "Unable to capture photo: #{e.}" ensure tempfile.unlink end end |