module Aploader
Current Usage: filename = 'something' base64string = 'something' processed_bin = Aploader.find(filename)
|| Aploader.create
(base64string, filename) if !processed_bin.nil?
processed_bin.file
end
Constants
- TMP_DIR
- VERSION
Public Class Methods
create(url_or_file, filename=nil, options={})
click to toggle source
# File lib/aploader.rb, line 19 def create(url_or_file, filename=nil, options={}) bp = TmpFile.new(filename) bp.process!(url_or_file, options) return bp end
find(filename)
click to toggle source
# File lib/aploader.rb, line 25 def find(filename) path = self.generate_path(filename) if File.exists?(path) return TmpFile.new(path.split('/').last.split('.').first, :file) end return nil end
generate_path(filename)
click to toggle source
# File lib/aploader.rb, line 33 def generate_path(filename) if filename.split('.').size > 1 return "#{TMP_DIR}/#{filename}" else return "#{TMP_DIR}/#{filename}.jpg" end end