dont produce broken JS when original size is selected
authorgc <gc>
Mon, 31 Jul 2006 11:46:19 +0000 (11:46 +0000)
committergc <gc>
Mon, 31 Jul 2006 11:46:19 +0000 (11:46 +0000)
bin/booh-backend

index 3b493e8843036f0c3e15129188d1e3a546d34aaf..86c2e3165952ed5389a2348cf2bb26ccb0d41477 100755 (executable)
@@ -420,7 +420,8 @@ def html_reload_to_thumbnails
     html_reload_to_thumbnails.gsub!(/~~default_size~~/, $default_size['name'])
     html_reload_to_thumbnails.gsub!(/~~all_sizes~~/, all_images_sizes.collect { |s| "\"#{size2js(s['name'])}\"" }.join(', '))
     size_auto_chooser = '';
     html_reload_to_thumbnails.gsub!(/~~default_size~~/, $default_size['name'])
     html_reload_to_thumbnails.gsub!(/~~all_sizes~~/, all_images_sizes.collect { |s| "\"#{size2js(s['name'])}\"" }.join(', '))
     size_auto_chooser = '';
-    all_images_sizes.sort { |a,b| b['optimizedforwidth'].to_i <=> a['optimizedforwidth'].to_i }.
+    all_images_sizes.find_all { |s| s.has_key?('optimizedforwidth') }.
+                     sort { |a,b| b['optimizedforwidth'].to_i <=> a['optimizedforwidth'].to_i }.
                      each { |s| size_auto_chooser += "if (w + 50 > #{s['optimizedforwidth']}) { return 'thumbnails-#{size2js(s['name'])}-0.html'; }\n" }
     html_reload_to_thumbnails.gsub!(/~~size_auto_chooser~~/, size_auto_chooser)
     return html_reload_to_thumbnails
                      each { |s| size_auto_chooser += "if (w + 50 > #{s['optimizedforwidth']}) { return 'thumbnails-#{size2js(s['name'])}-0.html'; }\n" }
     html_reload_to_thumbnails.gsub!(/~~size_auto_chooser~~/, size_auto_chooser)
     return html_reload_to_thumbnails