diff --git a/ui (gen4)/imagegrid/images.js b/ui (gen4)/imagegrid/images.js index 6286bafc..2af06202 100755 --- a/ui (gen4)/imagegrid/images.js +++ b/ui (gen4)/imagegrid/images.js @@ -29,6 +29,14 @@ if(typeof(sha1) != 'undefined'){ /*********************************************************************/ +var PLACEHOLDER = +module.PLACEHOLDER = + './images/placeholder.svg' + +var MISSING = +module.MISSING = + './images/missing.svg' + // A stub image, also here for documentation... var IMAGE_DATA = module.IMAGE_DATA = { @@ -51,16 +59,17 @@ module.IMAGE_DATA = { ctime: 0, // Original path... - path: './images/900px/SIZE.jpg', + //path: './images/900px/SIZE.jpg', + path: PLACEHOLDER, // Previews... // NOTE: the actual values depend on specific image and can be // any size... - preview: { - '150px': './images/150px/SIZE.jpg', - '350px': './images/350px/SIZE.jpg', - '900px': './images/900px/SIZE.jpg', - }, + //preview: { + // '150px': './images/150px/SIZE.jpg', + // '350px': './images/350px/SIZE.jpg', + // '900px': './images/900px/SIZE.jpg', + //}, // Classes // XXX currently unused... diff --git a/ui (gen4)/imagegrid/ribbons.js b/ui (gen4)/imagegrid/ribbons.js index 47a819ef..0d2d86e2 100755 --- a/ui (gen4)/imagegrid/ribbons.js +++ b/ui (gen4)/imagegrid/ribbons.js @@ -1462,17 +1462,23 @@ var RibbonsPrototype = { }, _loadImagePreviewURL: function(image, url){ + var recovery_tried url = util.path2url(url) // pre-cache and load image... // NOTE: this will make images load without a blackout... var img = new Image() var i = image instanceof jQuery ? image[0] : image img.onload = function(){ - i.style.backgroundImage = 'url("'+ url +'")', + i.style.backgroundImage = 'url("'+ img.src +'")', // NOTE: these do not account for rotation... i.setAttribute('preview-width', img.width) - i.setAttribute('preview-height', img.height) - } + i.setAttribute('preview-height', img.height) } + // error -> load placeholder... + img.onerror = function(){ + !recovery_tried + && (img.src = images.MISSING) + // give up after retry try... + recovery_tried = true } img.src = url return img }, diff --git a/ui (gen4)/images/missing.svg b/ui (gen4)/images/missing.svg new file mode 100644 index 00000000..e5adaa8b --- /dev/null +++ b/ui (gen4)/images/missing.svg @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + ERROR + + diff --git a/ui (gen4)/images/placeholder-image.svg b/ui (gen4)/images/placeholder.svg similarity index 100% rename from ui (gen4)/images/placeholder-image.svg rename to ui (gen4)/images/placeholder.svg