lib/balloon/uploader.rb in balloon-1.1.3 vs lib/balloon/uploader.rb in balloon-1.1.4
- old
+ new
@@ -16,12 +16,22 @@
def set_storage_engine
@storage_engine = eval(Balloon::Base::STORAGE_EGINE[store_storage.to_sym]).new(self) if !respond_to?(:@storage_engine)
end
def save_to_cache(up_file)
- uploader_file = up_file.is_a?(String) && up_file.include?("://") ? down_url(up_file) : up_file
+ upload_data = {}
+ uploader_file = up_file
+ if up_file.is_a?(String) && up_file.include?("://")
+ upload_data[:remote_url] = up_file
+ uploader_file = down_url(up_file)
+ end
+
+ if up_file.is_a?(ActionDispatch::Http::UploadedFile)
+ upload_data[:original_filename] = up_file.original_filename
+ end
+
uploader_file_ext = Balloon::FileExtension.new(uploader_file)
file_mime_type = uploader_file_ext.mime_type
if self.respond_to?(:uploader_mimetype_white)
if !uploader_mimetype_white.include?(file_mime_type)
@@ -42,10 +52,11 @@
width: @cache_meta[:width],
height: @cache_meta[:height],
size: @cache_meta[:size],
mime_type: @cache_meta[:mime_type],
extension: @cache_meta[:extension],
- data: @cache_meta[:data]
+ upload_data: upload_data,
+ data: upload_data.merge(@cache_meta[:data])
}
end
def url(size_name = nil); end