Class: UnprocessedImage

Inherits:
CarrierWave::Uploader::Base
  • Object
show all
Includes:
CarrierWave::MiniMagick
Defined in:
app/uploaders/unprocessed_image.rb

Overview

Copyright © 2010-2011, Diaspora Inc. This file is

licensed under the Affero General Public License version 3 or later.  See
the COPYRIGHT file.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#strip_exifObject

Returns the value of attribute strip_exif


10
11
12
# File 'app/uploaders/unprocessed_image.rb', line 10

def strip_exif
  @strip_exif
end

Instance Method Details

#basic_processObject


30
31
32
33
34
35
36
37
# File 'app/uploaders/unprocessed_image.rb', line 30

def basic_process
  manipulate! do |img|
    img.auto_orient
    img.strip if strip_exif
    img = yield(img) if block_given?
    img
  end
end

#extension_whitelistObject


20
21
22
# File 'app/uploaders/unprocessed_image.rb', line 20

def extension_whitelist
  %w[jpg jpeg png gif]
end

#filenameObject


24
25
26
# File 'app/uploaders/unprocessed_image.rb', line 24

def filename
  model.random_string + File.extname(@filename) if @filename
end

#get_version_dimensionsObject


46
47
48
# File 'app/uploaders/unprocessed_image.rb', line 46

def get_version_dimensions
  model.width, model.height = `identify -format "%wx%h " #{file.path}`.split(/x/)
end

#store_dirObject


16
17
18
# File 'app/uploaders/unprocessed_image.rb', line 16

def store_dir
  "uploads/images"
end