--- C:/Users/Robin/AppData/Local/Temp/imagebrowser.install-rev433.svn000.tmp.install	Wed Feb  3 14:47:46 2010
+++ C:/Users/Robin/AppData/Local/Temp/imagebrowser.install-rev458.svn000.tmp.install	Wed Feb  3 14:47:47 2010
@@ -94,27 +94,27 @@
 }
 
 function imagebrowser_schema() {
-    $schema['imagebrowser_styles'] = array(
-    'fields' => array(
-      'sid' => array(
-        'description' => t('The primary identifier for a style.'),
-        'type' => 'serial',
-        'unsigned' => TRUE,
-        'not null' => TRUE),
-      'name' => array(
-        'description' => t('The name of the CDN mirror.'),
-        'type' => 'varchar',
-        'length' => 20,
-        'not null' => TRUE,
-        'default' => ''),
-      'css' => array(
-        'description' => t('The css properties of the style.'),
-        'type' => 'text',
-        'size' => 'medium',
-        'not null' => TRUE,
-        'default' => ''),
-    ),
-    'primary key' => array('sid'),
+  $schema['imagebrowser_styles'] = array(
+  'fields' => array(
+    'sid' => array(
+      'description' => t('The primary identifier for a style.'),
+      'type' => 'serial',
+      'unsigned' => TRUE,
+      'not null' => TRUE),
+    'name' => array(
+      'description' => t('The name of the CDN mirror.'),
+      'type' => 'varchar',
+      'length' => 20,
+      'not null' => TRUE,
+      'default' => ''),
+    'css' => array(
+      'description' => t('The css properties of the style.'),
+      'type' => 'text',
+      'size' => 'medium',
+      'not null' => TRUE,
+      'default' => ''),
+  ),
+  'primary key' => array('sid'),
   );
 
   return $schema;
@@ -122,4 +122,65 @@
 
 /**
  * Updates
- */
\ No newline at end of file
+ */
+function imagebrowser_update_6100() {
+  $schema['imagebrowser_styles'] = array(
+  'fields' => array(
+    'sid' => array(
+      'description' => t('The primary identifier for a style.'),
+      'type' => 'serial',
+      'unsigned' => TRUE,
+      'not null' => TRUE),
+    'name' => array(
+      'description' => t('The name of the CDN mirror.'),
+      'type' => 'varchar',
+      'length' => 20,
+      'not null' => TRUE,
+      'default' => ''),
+    'css' => array(
+      'description' => t('The css properties of the style.'),
+      'type' => 'text',
+      'size' => 'medium',
+      'not null' => TRUE,
+      'default' => ''),
+  ),
+  'primary key' => array('sid'),
+  );
+  
+  $ret = array();
+  db_create_table($ret, 'imagebrowser_styles', $schema['imagebrowser_styles']);
+  return $ret;
+}
+
+function imagebrowser_update_6101() {
+  $ret = array();
+  // Install ImageCache presets
+  if (module_exists('imagecache')) {
+    $imagecache_presets = array(
+      array(
+        'presetname' => 'ib_thumbnail',
+      )
+    );
+    
+    $imagecache_actions = array(
+      'ib_thumbnail' => array(
+        'action' => 'imagecache_scale',
+        'data' => array(
+          'width' => 100,
+          'height' => 100,
+          'upscale' => 1,
+        ),
+        'weight' => 0,
+      )
+    );
+    
+    foreach ($imagecache_presets as $preset) {
+        $preset = imagecache_preset_save($preset);
+        $imagecache_actions[$preset['presetname']]['presetid'] = $preset['presetid'];
+        imagecache_action_save($imagecache_actions[$preset['presetname']]);
+        
+        drupal_set_message(t('ImageCache preset %id: %name and corresponding actions saved.', array('%id' => $preset['presetid'], '%name' => $preset['presetname'])));
+    }
+  }
+  return $ret;
+}
\ No newline at end of file
