--- imagefield.module.orig	2007-02-23 06:01:29.000000000 +0100
+++ imagefield.module	2007-09-06 14:42:37.000000000 +0200
@@ -121,6 +121,12 @@ function imagefield_file_update($node, &
       return array();
     }
   }
+  if ($file['flags']['rotate'] <> 0) {
+    image_rotate( $file['filepath'], $file['filepath'], (int)($file['flags']['rotate']*90));
+    if ( module_exists('imagecache') ) {
+      imagecache_image_flush( $file['filepath'] );
+    }
+  }
   if ($file['fid'] == 'upload') {  
     return imagefield_file_insert($node, $file, $field);
   }
@@ -479,6 +485,13 @@ function _imagefield_widget_form($node, 
           '#default_value' => 0,
         );
         
+        $form[$fieldname][$delta]['flags']['rotate'] = array(
+          '#type' => 'radios',
+          '#title' => t('Rotate'),
+          '#options' => array( t('0'), t('90'), t('180'), t('270')),
+          '#default_value' => 0,
+        );
+        
         $filename = $file['fid'] == 'upload' ? file_create_filename($file['filename'], file_create_path($field['widget']['image_path'])) : $file['filepath'];
         
         $form[$fieldname][$delta]['preview'] = array(
