Index: trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java	(revision 7955)
+++ trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ImageDisplay.java	(revision 7956)
@@ -27,4 +27,5 @@
 
 import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.tools.ExifReader;
 
 public class ImageDisplay extends JComponent {
@@ -103,35 +104,15 @@
                     final int h = (int) visibleRect.getHeight();
 
-                    outer: {
-                        final int hh, ww, q;
-                        final double ax, ay;
-                        switch (orientation) {
-                        case 8:
-                            q = -1;
-                            ax = w / 2;
-                            ay = w / 2;
+                    if (ExifReader.orientationNeedsCorrection(orientation)) {
+                        final int hh, ww;
+                        if (ExifReader.orientationSwitchesDimensions(orientation)) {
                             ww = h;
                             hh = w;
-                            break;
-                        case 3:
-                            q = 2;
-                            ax = w / 2;
-                            ay = h / 2;
+                        } else {
                             ww = w;
                             hh = h;
-                            break;
-                        case 6:
-                            q = 1;
-                            ax = h / 2;
-                            ay = h / 2;
-                            ww = h;
-                            hh = w;
-                            break;
-                        default:
-                            break outer;
                         }
-
                         final BufferedImage rot = new BufferedImage(ww, hh, BufferedImage.TYPE_INT_RGB);
-                        final AffineTransform xform = AffineTransform.getQuadrantRotateInstance(q, ax, ay);
+                        final AffineTransform xform = ExifReader.getRestoreOrientationTransform(orientation, w, h);
                         final Graphics2D g = rot.createGraphics();
                         g.drawImage(image, xform, null);
Index: trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ThumbsLoader.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ThumbsLoader.java	(revision 7955)
+++ trunk/src/org/openstreetmap/josm/gui/layer/geoimage/ThumbsLoader.java	(revision 7956)
@@ -7,4 +7,5 @@
 import java.awt.Rectangle;
 import java.awt.Toolkit;
+import java.awt.geom.AffineTransform;
 import java.awt.image.BufferedImage;
 import java.util.ArrayList;
@@ -13,4 +14,5 @@
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.io.CacheFiles;
+import org.openstreetmap.josm.tools.ExifReader;
 
 public class ThumbsLoader implements Runnable {
@@ -79,10 +81,27 @@
             return null;
         }
+
+        final int w = img.getWidth(null);
+        final int h = img.getHeight(null);
+        final int hh, ww;
+        if (ExifReader.orientationSwitchesDimensions(entry.getExifOrientation())) {
+            ww = h;
+            hh = w;
+        } else {
+            ww = w;
+            hh = h;
+        }
+
         Rectangle targetSize = ImageDisplay.calculateDrawImageRectangle(
-                new Rectangle(0, 0, img.getWidth(null), img.getHeight(null)),
+                new Rectangle(0, 0, ww, hh),
                 new Rectangle(0, 0, maxSize, maxSize));
         BufferedImage scaledBI = new BufferedImage(targetSize.width, targetSize.height, BufferedImage.TYPE_INT_RGB);
         Graphics2D g = scaledBI.createGraphics();
-        while (!g.drawImage(img, 0, 0, targetSize.width, targetSize.height, null)) {
+
+        final AffineTransform restoreOrientation = ExifReader.getRestoreOrientationTransform(entry.getExifOrientation(), w, h);
+        final AffineTransform scale = AffineTransform.getScaleInstance((double) targetSize.width / ww, (double) targetSize.height / hh);
+        scale.concatenate(restoreOrientation);
+
+        while (!g.drawImage(img, scale, null)) {
             try {
                 Thread.sleep(10);
Index: trunk/src/org/openstreetmap/josm/gui/preferences/projection/CustomProjectionChoice.java
===================================================================
--- trunk/src/org/openstreetmap/josm/gui/preferences/projection/CustomProjectionChoice.java	(revision 7955)
+++ trunk/src/org/openstreetmap/josm/gui/preferences/projection/CustomProjectionChoice.java	(revision 7956)
@@ -188,5 +188,5 @@
             s.append(listKeys(Projections.nadgrids)+"<br>");
             s.append("<b>+bounds=</b>minlon,minlat,maxlon,maxlat - <i>"+tr("Projection bounds (in degrees)")+"</i><br>");
-            s.append("<b>+wmssrs=</b>EPSG:123456 - <i>"+tr("WMS SRS (EPSG code)")+"</i><br>");
+            s.append("<b>+wmssrs=</b>EPSG:123456 - <i>"+tr("Sets the SRS=... parameter in the WMS request")+"</i><br>");
 
             return new HtmlPanel(s.toString());
Index: trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
===================================================================
--- trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java	(revision 7955)
+++ trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java	(revision 7956)
@@ -1084,5 +1084,4 @@
             }
         }
-        return;
     }
 
Index: trunk/src/org/openstreetmap/josm/tools/ExifReader.java
===================================================================
--- trunk/src/org/openstreetmap/josm/tools/ExifReader.java	(revision 7955)
+++ trunk/src/org/openstreetmap/josm/tools/ExifReader.java	(revision 7956)
@@ -21,4 +21,5 @@
 import com.drew.metadata.exif.ExifSubIFDDirectory;
 import com.drew.metadata.exif.GpsDirectory;
+import java.awt.geom.AffineTransform;
 
 /**
@@ -188,3 +189,65 @@
         return value;
     }
+
+    /**
+     * Returns a Transform that fixes the image orientation.
+     *
+     * Only orientation 1, 3, 6 and 8 are supported. Everything else is treated
+     * as 1.
+     * @param orientation the exif-orientation of the image
+     * @param width the original width of the image
+     * @param height the original height of the image
+     * @return a transform that rotates the image, so it is upright
+     */
+    public static AffineTransform getRestoreOrientationTransform(final int orientation, final int width, final int height) {
+        final int q;
+        final double ax, ay;
+        switch (orientation) {
+        case 8:
+            q = -1;
+            ax = width / 2;
+            ay = width / 2;
+            break;
+        case 3:
+            q = 2;
+            ax = width / 2;
+            ay = height / 2;
+            break;
+        case 6:
+            q = 1;
+            ax = height / 2;
+            ay = height / 2;
+            break;
+        default:
+            q = 0;
+            ax = 0;
+            ay = 0;
+        }
+        return AffineTransform.getQuadrantRotateInstance(q, ax, ay);
+    }
+
+    /**
+     * Check, if the given orientation switches width and height of the image.
+     * E.g. 90 degree rotation
+     *
+     * Only orientation 1, 3, 6 and 8 are supported. Everything else is treated
+     * as 1.
+     * @param orientation the exif-orientation of the image
+     * @return true, if it switches width and height
+     */
+    public static boolean orientationSwitchesDimensions(int orientation) {
+        return orientation == 6 || orientation == 8;
+    }
+
+    /**
+     * Check, if the given orientation requires any correction to the image.
+     *
+     * Only orientation 1, 3, 6 and 8 are supported. Everything else is treated
+     * as 1.
+     * @param orientation the exif-orientation of the image
+     * @return true, unless the orientation value is 1 or unsupported.
+     */
+    public static boolean orientationNeedsCorrection(int orientation) {
+        return orientation == 3 || orientation == 6 || orientation == 8;
+    }
 }
