Skip to content
Browse files

fix gallery-demo.php rendering of the gallery set: draw the icon for …

…those items which don't come with a thumbnail (this can happen for quite a few filetypes, also for overlarge images and files which otherwise failed to have the server produce a thumbnail for them)
  • Loading branch information...
1 parent 1097641 commit 2d1628a17e4e993bbdf206ab79500dd016c11550 @GerHobbelt GerHobbelt committed Apr 30, 2011
Showing with 17 additions and 1 deletion.
  1. +17 −1 Demos/gallery-demo.php
View
18 Demos/gallery-demo.php
@@ -146,8 +146,16 @@
return (''+str).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
};
+ var tnimg = metadata.thumb250;
var iw = metadata.thumb250_width;
var ih = metadata.thumb250_height;
+ // if thumbnail is not available (can happen for quite a few file types! And for overlarge images too! Plus for other errors!) pcik the icon48 instead:
+ if (!tnimg)
+ {
+ tnimg = metadata.icon48;
+ iw = 48;
+ ih = 48;
+ }
var ratio;
if (iw > thumb_side_length)
{
@@ -181,7 +189,7 @@
}
}).adopt(
new Element('img', {
- src: metadata.thumb250,
+ src: tnimg,
alt: '',
styles: {
width: iw,
@@ -253,8 +261,16 @@
var metadata = gallery_json_metadata[key];
+ var tnimg = metadata.thumb250;
var iw = metadata.thumb250_width;
var ih = metadata.thumb250_height;
+ // if thumbnail is not available (can happen for quite a few file types! And for overlarge images too! Plus for other errors!) pcik the icon48 instead:
+ if (!tnimg)
+ {
+ tnimg = metadata.icon48;
+ iw = 48;
+ ih = 48;
+ }
var ratio;
if (iw > thumb_side_length)
{

0 comments on commit 2d1628a

Please sign in to comment.
Something went wrong with that request. Please try again.