Sha256: e88123ec6f82ef33c660bd02cdfa307b22d81074d166a3a80bdc973365c4713b

Contents?: true

Size: 632 Bytes

Versions: 13

Compression:

Stored size: 632 Bytes

Contents

class Phcpresspro::PstimageUploader < CarrierWave::Uploader::Base

	# Storage Type
	storage :file
	# storage :fog

	# Where files will be uploaded
	def store_dir
		"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
	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

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
phcpresspro-2.2.5 app/uploaders/phcpresspro/pstimage_uploader.rb
phcpresspro-2.2.3 app/uploaders/phcpresspro/pstimage_uploader.rb
phcpresspro-2.2.2 app/uploaders/phcpresspro/pstimage_uploader.rb
phcpresspro-2.2.1 app/uploaders/phcpresspro/pstimage_uploader.rb
phcpresspro-2.2.0 app/uploaders/phcpresspro/pstimage_uploader.rb
phcpresspro-2.1.3 app/uploaders/phcpresspro/pstimage_uploader.rb
phcpresspro-2.1.2 app/uploaders/phcpresspro/pstimage_uploader.rb
phcpresspro-2.1.1 app/uploaders/phcpresspro/pstimage_uploader.rb
phcpresspro-2.1.0 app/uploaders/phcpresspro/pstimage_uploader.rb
phcpresspro-2.0.1 app/uploaders/phcpresspro/pstimage_uploader.rb
phcpresspro-2.0.0 app/uploaders/phcpresspro/pstimage_uploader.rb
phcpresspro-1.6.1 app/uploaders/phcpresspro/pstimage_uploader.rb
phcpresspro-1.6.0 app/uploaders/phcpresspro/pstimage_uploader.rb