diff --git a/apps/files_imageviewer/css/lightbox.css b/apps/files_imageviewer/css/lightbox.css
index a6e844a2e28b58e08051c6f19c1fd6abcccb9df8..d96dd051b1e4cac4e16334410ef55088cc79fb4f 100644
--- a/apps/files_imageviewer/css/lightbox.css
+++ b/apps/files_imageviewer/css/lightbox.css
@@ -20,4 +20,13 @@
 	margin-left:auto;
 	margin-right:auto;
 	z-index:9999;
-}
\ No newline at end of file
+}
+
+#lightbox_loader{
+  text-align:center;
+  position:fixed;
+  top: 40%;
+  left: 50%;
+  color:white;
+}
+#lightbox_loader img { margin-right: 1em;}
\ No newline at end of file
diff --git a/apps/files_imageviewer/js/lightbox.js b/apps/files_imageviewer/js/lightbox.js
index 847954d2f15bc7ca9dd2328a9d0733141d488af3..4f079b6d8aff59d5e7997f1dccfac83c4b8bad1c 100644
--- a/apps/files_imageviewer/js/lightbox.js
+++ b/apps/files_imageviewer/js/lightbox.js
@@ -2,11 +2,17 @@
 var lightBoxShown=false;
 $(document).ready(function() {
 	images={};//image cache
-	var overlay=$('<div id="lightbox_overlay"/>');
+	loading_str = t('files_imageviewer','Loading');
+	var overlay=$('<div id="lightbox_overlay"><div id="lightbox_loader"><img /></div></div>');
+	overlay.find('#lightbox_loader img')
+		.attr('src',OC.imagePath('core', 'loading-dark.gif'))
+		.attr('alt',loading_str)
+		.after(loading_str);
 	$( 'body' ).append(overlay);
 	var container=$('<div id="lightbox"/>');
 	$( 'body' ).append(container);
-	$( 'body' ).click(hideLightbox);
+	$( '#lightbox_overlay' ).click(hideLightbox);
+	$( '#lightbox' ).click(hideLightbox);
 	if(typeof FileActions!=='undefined'){
 		FileActions.register('image','View','',function(filename){
 			viewImage($('#dir').val(),filename);
@@ -35,7 +41,8 @@ function viewImage(dir,file){
 		var img = new Image();
 		img.onload = function(){
 			images[location]=img;
-			showLightbox(container,img);
+			if($('#lightbox_overlay').is(':visible'))
+				showLightbox(container,img);
 		}
 		img.src = location;
 	}else{
@@ -67,10 +74,10 @@ function showLightbox(container,img){
 }
 
 function hideLightbox(event){
-	if(lightBoxShown){
+	if(event){
 		event.stopPropagation();
 		$('#lightbox_overlay').hide();
 		$('#lightbox').hide();
 		lightBoxShown=false;
 	}
-}
+}
\ No newline at end of file
diff --git a/core/img/loading-dark.gif b/core/img/loading-dark.gif
new file mode 100644
index 0000000000000000000000000000000000000000..5fe86acabc41f3cd97b09eb626e5e9020d5ea28e
Binary files /dev/null and b/core/img/loading-dark.gif differ