Index: CHANGELOG.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/CHANGELOG.txt,v
retrieving revision 1.68
diff -u -p -r1.68 CHANGELOG.txt
--- CHANGELOG.txt	9 Aug 2009 17:24:37 -0000	1.68
+++ CHANGELOG.txt	9 Aug 2009 17:33:50 -0000
@@ -6,7 +6,9 @@ Image x.x-x.x, xxxx-xx-xx
 
 Image 6.x-1.x, xxxx-xx-xx
 -------------------------
-#374423 by joachim: Fixed image_create_node_from not checking image filesize.
+#470720 by joachim, sun: Fixed Image Gallery vocabulary broken after re-enabling
+  the module.
+#374423 by joachim: Fixed image_create_node_from() not checking image filesize.
 #44057 by sun: Fixed return values of image_access().
 by joachim: Code clean-up in Image gallery module.
 by joachim: Added PHPdoc headers to functions in Image gallery module.
Index: contrib/image_gallery/image_gallery.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/contrib/image_gallery/image_gallery.install,v
retrieving revision 1.14
diff -u -p -r1.14 image_gallery.install
--- contrib/image_gallery/image_gallery.install	9 Aug 2009 17:09:11 -0000	1.14
+++ contrib/image_gallery/image_gallery.install	9 Aug 2009 17:30:44 -0000
@@ -25,7 +25,6 @@ function image_gallery_uninstall() {
   if ($vid = variable_get('image_gallery_nav_vocabulary', FALSE)) {
     module_invoke('taxonomy', 'del_vocabulary', $vid);
   }
-
   variable_del('image_images_per_page');
   variable_del('image_gallery_nav_vocabulary');
   variable_del('image_gallery_node_info');
Index: contrib/image_gallery/image_gallery.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/image/contrib/image_gallery/image_gallery.module,v
retrieving revision 1.40
diff -u -p -r1.40 image_gallery.module
--- contrib/image_gallery/image_gallery.module	9 Aug 2009 17:03:03 -0000	1.40
+++ contrib/image_gallery/image_gallery.module	9 Aug 2009 17:28:06 -0000
@@ -505,12 +505,34 @@ function theme_image_gallery_img($image,
  * Returns (and possibly creates) a new vocabulary for Image galleries.
  */
 function _image_gallery_get_vid() {
-  $vid = variable_get('image_gallery_nav_vocabulary', '');
-  if (empty($vid) || is_null(taxonomy_vocabulary_load($vid))) {
-    // Check to see if an image gallery vocabulary exists
-    $vid = db_result(db_query("SELECT vid FROM {vocabulary} WHERE module='image_gallery'"));
-    if (!$vid) {
-      $vocabulary = array('name' => t('Image Galleries'), 'multiple' => '0', 'required' => '0', 'hierarchy' => '1', 'relations' => '0', 'module' => 'image_gallery', 'nodes' => array('image' => 1));
+  $vid = variable_get('image_gallery_nav_vocabulary', NULL);
+  // This is invoked from many locations and only D7 ensures that required
+  // modules are installed/enabled first.
+  // @todo Perhaps also disable image_gallery module and report an error?
+  if (!module_exists('taxonomy')) {
+    return $vid;
+  }
+  if (empty($vid) || !($vocabulary = taxonomy_vocabulary_load($vid))) {
+    // Check to see if an image gallery vocabulary exists.
+    $vid = db_result(db_query("SELECT vid FROM {vocabulary} WHERE module = 'image_gallery'"));
+    if (!$vid && !$vocabulary) {
+      $vocabulary = array(
+        'name' => t('Image Galleries'),
+        'multiple' => 0,
+        'required' => 0,
+        'hierarchy' => 1,
+        'relations' => 0,
+        'module' => 'image_gallery',
+        'nodes' => array('image' => 1),
+      );
+      taxonomy_save_vocabulary($vocabulary);
+      $vid = $vocabulary['vid'];
+    }
+    elseif ($vocabulary) {
+      // Existing install; ensure that image node type is still assigned.
+      // Keep all other node types intact there.
+      $vocabulary = (array) $vocabulary;
+      $vocabulary['nodes']['image'] = 1;
       taxonomy_save_vocabulary($vocabulary);
       $vid = $vocabulary['vid'];
     }
