diff -rNup orig/classes/AlbumItem.php rotate/classes/AlbumItem.php
--- orig/classes/AlbumItem.php	2004-06-02 20:27:40.000000000 +0200
+++ rotate/classes/AlbumItem.php	2004-06-12 17:51:04.000000000 +0200
@@ -422,12 +422,17 @@ class AlbumItem {
 		return $im->isResized();
 	}
 
-	function rotate($dir, $direction, $thumb_size, &$album) {
+	function rotate($dir, $direction, $thumb_size, &$album, $clearexifrotate=false) {
 		global $gallery;
 
 		$name = $this->image->name;
 		$type = $this->image->type;
 		$retval = rotate_image("$dir/$name.$type", "$dir/$name.$type", $direction, $type);
+		if ($clearexifrotate && isset($gallery->app->use_exif) && ($type === 'jpg' || $type === 'jpeg')) {
+		    $path = $gallery->app->use_exif;
+		    exec_internal(fs_import_filename($path, 1) . " -norot '$dir/$name.$type'");
+		}
+
 		if (!$retval) {
 			return $retval;
 		}
@@ -436,6 +441,11 @@ class AlbumItem {
 
 		if ($this->isResized()) {
 			rotate_image("$dir/$name.sized.$type", "$dir/$name.sized.$type", $direction, $type);
+			if ($clearexifrotate && isset($gallery->app->use_exif) && ($type === 'jpg' || $type === 'jpeg')) {
+			    $path = $gallery->app->use_exif;
+			    exec_internal(fs_import_filename($path, 1) . " -norot '$dir/$name.sized.$type'");
+			}
+
 			list($w, $h) = getDimensions("$dir/$name.sized.$type");
 			$this->image->setDimensions($w, $h);	
 		} else {
diff -rNup orig/classes/Album.php rotate/classes/Album.php
--- orig/classes/Album.php	2004-06-02 20:26:49.000000000 +0200
+++ rotate/classes/Album.php	2004-06-12 17:43:09.000000000 +0200
@@ -1026,7 +1026,7 @@ class Album {
 				       	$rotate = 0;
 			       	}
 			       	if ($rotate) {
-				       	$this->rotatePhoto($index, $rotate);
+				       	$this->rotatePhoto($index, $rotate, true);
 				       	processingMsg("- ". _("Photo auto-rotated/transformed"));
 			       	}
 		       	}
@@ -1386,10 +1386,10 @@ class Album {
 		$photo->setKeywords($keywords);
         }
 
-	function rotatePhoto($index, $direction) {
+	function rotatePhoto($index, $direction, $clearexifrotate=false) {
 		$this->updateSerial = 1;
 		$photo = &$this->getPhoto($index);
-		$retval = $photo->rotate($this->getAlbumDir(), $direction, $this->fields["thumb_size"], $this);
+		$retval = $photo->rotate($this->getAlbumDir(), $direction, $this->fields["thumb_size"], $this, $clearexifrotate);
 		if (!$retval) {
 			return $retval;
 		}

