diff --git a/core/app/helpers/refinery/image_helper.rb b/core/app/helpers/refinery/image_helper.rb
index 5dc1a69921..2e78955da5 100644
--- a/core/app/helpers/refinery/image_helper.rb
+++ b/core/app/helpers/refinery/image_helper.rb
@@ -6,18 +6,16 @@ module ImageHelper
# replace all system images with a thumbnail version of them (handy for all images inside a page part)
# for example, <%= content_fu(@page.content_for(:body), '96x96#c') %> converts all /system/images to a 96x96 cropped thumbnail
def content_fu(content, thumbnail)
- content.gsub(%r{}) do |image_match|
- begin
- uid = Dragonfly::Job.from_path(
- "#{image_match.match(%r{(/system/images/.+?)/})[1]}", Dragonfly[:refinery_images]
- ).uid
+ content.gsub(%r{}) do |img|
+ begin
+ sha = img.match(%r{/system/images/(.+?)/})[1]
+ job = Dragonfly::Job.deserialize sha, Dragonfly[:refinery_images]
- image_fu Image.where(:image_uid => uid).first, thumbnail
- rescue
- # FAIL, don't care why but return what we found initially.
- image_match
- end
- end
+ image_fu Image.where(:image_uid => job.uid).first, thumbnail
+ rescue Dragonfly::Serializer::BadString
+ img
+ end
+ end
end
# image_fu is a helper for inserting an image that has been uploaded into a template.