- this.$img.attr( {
- src: this.$thumbnail.attr( 'src' ),
- alt: this.$thumbnail.attr( 'alt' )
- } );
- this.$imgLink.attr( 'href', $imageLi.find( 'a' ).eq( 0 ).attr( 'href' ) );
+ if ( this.$thumbnail.length ) {
+ // 2. Create and show thumbnail
+ this.$img = $( '<img>' ).attr( {
+ src: this.$thumbnail.attr( 'src' ),
+ alt: this.$thumbnail.attr( 'alt' )
+ } );
+ // 'image' class required for detection by MultimediaViewer
+ $imgLink = $( '<a>' ).addClass( 'image' )
+ .attr( 'href', $imageLi.find( 'a' ).eq( 0 ).attr( 'href' ) )
+ .append( this.$img );
+
+ this.$imgContainer.empty().append( $imgLink );
+ } else {
+ // 2b. No image found (e.g. file doesn't exist)
+ this.$imgContainer.text( $imageLi.find( '.thumb' ).text() );
+ }