Sha256: d4e56883221500e0a254a8b9e8d4b31d3699a28e515e4c5c17cfb63232570869

Contents?: true

Size: 629 Bytes

Versions: 88

Compression:

Stored size: 629 Bytes

Contents

class Phcpress::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

88 entries across 88 versions & 1 rubygems

Version Path
phcpress-7.1.2 app/uploaders/phcpress/pstimage_uploader.rb
phcpress-7.1.1 app/uploaders/phcpress/pstimage_uploader.rb
phcpress-7.1.0 app/uploaders/phcpress/pstimage_uploader.rb
phcpress-7.0.0 app/uploaders/phcpress/pstimage_uploader.rb
phcpress-6.7.3 app/uploaders/phcpress/pstimage_uploader.rb
phcpress-6.7.2 app/uploaders/phcpress/pstimage_uploader.rb
phcpress-6.7.1 app/uploaders/phcpress/pstimage_uploader.rb
phcpress-6.7.0 app/uploaders/phcpress/pstimage_uploader.rb
phcpress-6.6.6 app/uploaders/phcpress/pstimage_uploader.rb
phcpress-6.6.5 app/uploaders/phcpress/pstimage_uploader.rb
phcpress-6.6.4 app/uploaders/phcpress/pstimage_uploader.rb
phcpress-6.6.3 app/uploaders/phcpress/pstimage_uploader.rb
phcpress-6.6.1 app/uploaders/phcpress/pstimage_uploader.rb
phcpress-6.6.0 app/uploaders/phcpress/pstimage_uploader.rb
phcpress-6.5.1 app/uploaders/phcpress/pstimage_uploader.rb
phcpress-6.5.0 app/uploaders/phcpress/pstimage_uploader.rb
phcpress-6.4.5 app/uploaders/phcpress/pstimage_uploader.rb
phcpress-6.4.4 app/uploaders/phcpress/pstimage_uploader.rb
phcpress-6.4.3 app/uploaders/phcpress/pstimage_uploader.rb
phcpress-6.4.2 app/uploaders/phcpress/pstimage_uploader.rb