Devin's changes to integrate the store

This commit is contained in:
OrbitServer committed 2012-12-06 16:06:47 +08:00
1 parent e68c52bc00
commit 9683741ec9
26 files changed
+1639 -37

No files matched your search

+12 -5
View File
@@ -3,6 +3,7 @@
class ImageUploader < CarrierWave::Uploader::Base
require 'mime/types'
require 'carrierwave/processing/mini_magick'
include Sprockets::Helpers::RailsHelper
process :set_content_type
@@ -61,15 +62,21 @@ class ImageUploader < CarrierWave::Uploader::Base
# def filename
# "something.jpg" if original_filename
# end
def cache_dir
"#{Rails.root}/tmp/uploads"
end
def manipulate!
cache_stored_file! if !cached?
#raise File.extname(current_path.to_s).to_s
image = ::MiniMagick::Image.open(current_path)
image = yield(image)
image.write(current_path)
::MiniMagick::Image.open(current_path)
rescue
nil
# image = yield(image)
# image.write(current_path)
# ::MiniMagick::Image.open(current_path)
# rescue
# nil
end
end