Index: wp-includes/media.php
===================================================================
--- wp-includes/media.php	(revision 22974)
+++ wp-includes/media.php	(working copy)
@@ -1929,13 +1929,13 @@
 			}
 
 			#{{ data.id }} .portrait .thumbnail img {
-				width: {{ data.edge }}px;
+				max-width: {{ data.edge }}px;
 				height: auto;
 			}
 
 			#{{ data.id }} .landscape .thumbnail img {
 				width: auto;
-				height: {{ data.edge }}px;
+				max-height: {{ data.edge }}px;
 			}
 		</style>
 	</script>
