app/helpers/uploadbox/img_helper.rb in uploadbox-0.1.4 vs app/helpers/uploadbox/img_helper.rb in uploadbox-0.2.0.beta
- old
+ new
@@ -2,11 +2,10 @@
module ImgHelper
def s3_policy
Base64.encode64(policy_data.to_json).gsub("\n", "")
end
-
def s3_signature
Base64.encode64(
OpenSSL::HMAC.digest(
OpenSSL::Digest::Digest.new('sha1'),
CarrierWave::Uploader::Base.fog_credentials[:aws_secret_access_key],
@@ -15,10 +14,24 @@
).gsub("\n", "")
end
def img(source, options={})
if source.respond_to?(:url) and source.respond_to?(:width) and source.respond_to?(:height)
- image_tag(source.url, {width: source.width, height: source.height}.merge(options))
+ if source.processing?
+ data = {
+ processing: source.processing?,
+ original: source.original_file,
+ component: 'ShowImage'
+ }
+ content_tag :div, class: 'uploadbox-image-container uploadbox-processing', style: "width: #{source.width}px; height: #{source.height}px", data: data do
+ image_tag(source.url, {width: source.width, height: source.height, style: 'display: none'}.merge(options))
+ end
+ else
+ data = {}
+ content_tag :div, class: 'uploadbox-image-container', width: source.width, height: source.height, data: data do
+ image_tag(source.url, {width: source.width, height: source.height}.merge(options))
+ end
+ end
else
image_tag(source, options)
end
end