app/uploaders/phcpresspro/pstimage_uploader.rb in phcpresspro-2.2.5 vs app/uploaders/phcpresspro/pstimage_uploader.rb in phcpresspro-3.0.0
- old
+ new
@@ -1,30 +1,15 @@
class Phcpresspro::PstimageUploader < CarrierWave::Uploader::Base
- # Storage Type
- storage :file
- # storage :fog
+ # Include Cloudinary (Install Cloudinary Gem in Gemfile)
+ include Cloudinary::CarrierWave
- # Where files will be uploaded
- def store_dir
- "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
- end
+ # Image Version
+ version :standard do
+ process :resize_to_fill => [100, 150, :north]
+ end
- # White List of Safe Extension
- def extension_white_list
- %w(jpg jpeg gif png)
- end
-
- # Hash filenames
- def filename
- "#{secure_token}.#{file.extension}" if original_filename.present?
- end
-
- protected
-
- # Secure Token for File Hashing
- def secure_token
- var = :"@#{mounted_as}_secure_token"
- model.instance_variable_get(var) or model.instance_variable_set(var, SecureRandom.uuid)
- end
+ version :thumbnail do
+ resize_to_fit(50, 50)
+ end
end
\ No newline at end of file