From d2d6bb7fd5a5b2d28f3a05a1ef4af84eaefdab1f Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 31 Jul 2012 11:34:28 -0400 Subject: [PATCH 1/2] use proper absolute url for image urls --- public/javascripts/outfits/edit.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/public/javascripts/outfits/edit.js b/public/javascripts/outfits/edit.js index 60a899f4..0f6682bc 100644 --- a/public/javascripts/outfits/edit.js +++ b/public/javascripts/outfits/edit.js @@ -631,14 +631,17 @@ View.Outfits = function (wardrobe) { wardrobe.outfits.toggleOutfitStar(el.tmplItem().data); }); - function pathToUrl(path) { - var host = document.location.protocol + "//" + document.location.host; - if(document.location.port) host += ":" + document.location.port; - return host + path; + function absoluteUrl(path_or_url) { + if(path_or_url.indexOf('://') == -1) { + var host = document.location.protocol + "//" + document.location.host; + return host + path_or_url; + } else { + return path_or_url; + } } function generateOutfitPermalink(outfit) { - return pathToUrl("/outfits/" + outfit.id); + return absoluteUrl("/outfits/" + outfit.id); } function setOutfitPermalink(outfit, outfit_permalink_el, outfit_url_el) { @@ -785,9 +788,9 @@ View.Outfits = function (wardrobe) { // to discover if this is a new outfit ID or not fails. current_shared_outfit = outfit.clone(); urls.permalink = generateOutfitPermalink(outfit); - urls.small_image = pathToUrl(outfit.image_versions.small); - urls.medium_image = pathToUrl(outfit.image_versions.medium); - urls.large_image = pathToUrl(outfit.image_versions.large); + urls.small_image = absoluteUrl(outfit.image_versions.small); + urls.medium_image = absoluteUrl(outfit.image_versions.medium); + urls.large_image = absoluteUrl(outfit.image_versions.large); formatUrls(); WRAPPER.removeClass('thumbnail-available'); subscribeToImageIfVisible(current_shared_outfit); From 2b88ce9b4b59237ec6f778fc9fa30648f97bb09d Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 31 Jul 2012 11:42:27 -0400 Subject: [PATCH 2/2] use openneo-uploads bucket --- app/models/outfit_image_uploader.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/outfit_image_uploader.rb b/app/models/outfit_image_uploader.rb index 6bbf26c4..b8f0c81e 100644 --- a/app/models/outfit_image_uploader.rb +++ b/app/models/outfit_image_uploader.rb @@ -5,7 +5,7 @@ class OutfitImageUploader < CarrierWave::Uploader::Base include CarrierWave::MiniMagick # Settings for S3 storage. Will only be used on production. - fog_directory 'impress-outfit-images' + fog_directory 'openneo-uploads' fog_attributes 'Cache-Control' => "max-age=#{15.minutes}", 'Content-Type' => 'image/png'