diff --git a/plugins/photo.inc b/plugins/photo.inc
index 66159e2..a843040 100644
--- a/plugins/photo.inc
+++ b/plugins/photo.inc
@@ -52,13 +52,13 @@ function fbsmp_photo_fbsmp_admin_settings_form(&$form_state) {
     '#description' => t('The minimum allowed image size expressed as WIDTHxHEIGHT (e.g. 640x480). Set to 0 for no restriction. If an image that is smaller than these dimensions is uploaded, it will be rejected.'),
   );
 
-  if (module_exists('imagecache')) {
+  if (module_exists('image')) {
     $presets_options = array(0 => t('Original image (no preset)'));
-    foreach (imagecache_presets() as $preset) {
-      $presets_options[$preset['presetname'] . ':default'] = t('@preset image', array('@preset' => $preset['presetname']));
-      $presets_options[$preset['presetname'] . ':imagelink'] = t('@preset image linked to image', array('@preset' => $preset['presetname']));
-      $presets_options[$preset['presetname'] . ':path'] = t('@preset file path', array('@preset' => $preset['presetname']));
-      $presets_options[$preset['presetname'] . ':url'] = t('@preset URL', array('@preset' => $preset['presetname']));
+    foreach (image_styles() as $presetname => $preset) {
+      $presets_options[$presetname . ':default'] = t('@preset image', array('@preset' => $presetname));
+      $presets_options[$presetname . ':imagelink'] = t('@preset image linked to image', array('@preset' => $presetname));
+      $presets_options[$presetname . ':path'] = t('@preset file path', array('@preset' => $presetname));
+      $presets_options[$presetname . ':url'] = t('@preset URL', array('@preset' => $presetname));
     }
     $form['general']['imagecache_preset'] = array(
       '#type' => 'select',
@@ -173,7 +173,7 @@ function fbsmp_photo_fbsmp_admin_settings_form_submit(&$form, &$form_state) {
   $settings['max_filesize'] = $form_values['max_filesize'];
   $settings['min_resolution'] = $form_values['min_resolution'];
   $settings['max_resolution'] = $form_values['max_resolution'];
-  if (module_exists('imagecache')) {
+  if (module_exists('image')) {
 	$settings['imagecache_preset'] = $form_values['imagecache_preset'];
   }
   $settings['file_path'] = $form_values['file_path'];
@@ -414,15 +414,15 @@ function theme_fbsmp_photo_attachment_imagecache($variables) {
   
   switch ($style) {
     case 'default':
-      return theme('image_style', array('style_name' => $presetname, 'path' => $file['filepath'], 'alt' => $alt, 'title' => $title, 'attributes' => $attributes));
+      return theme('image_style', array('style_name' => $presetname, 'path' => $file['uri'], 'alt' => $alt, 'title' => $title, 'attributes' => $attributes));
     case 'imagelink':
-      $thumbnail = theme('image_style', array('style_name' => $presetname, 'path' => $file['filepath'], 'alt' => $alt, 'title' => $title, 'attributes' => $attributes));
-      $url =  file_create_url($file['filepath']);
+      $thumbnail = theme('image_style', array('style_name' => $presetname, 'path' => $file['uri'], 'alt' => $alt, 'title' => $title, 'attributes' => $attributes));
+      $url =  file_create_url($file['uri']);
       return l($thumbnail, $url, array('html' => TRUE));
     case 'path':
-      return imagecache_create_path($presetname, $file['filepath']);
+      return image_style_path($presetname, $file['uri']);
     case 'url':
-      return imagecache_create_url($presetname, $file['filepath']);
+      return image_style_url($presetname, $file['uri']);
   }
 }
 
@@ -431,11 +431,12 @@ function theme_fbsmp_photo_attachment_imagecache($variables) {
  */
 function fbsmp_photo_fbsmp_themed_attachment($attachment) {
   $settings = fbsmp_load_plugin_settings('photo');
-  if (module_exists('imagecache') && $settings['imagecache_preset']) {
+  $attributes = '';
+  if (module_exists('image') && $settings['imagecache_preset']) {
     if (isset($settings['class']) && $settings['class']) {
       $attributes = array('class' => $settings['class']);
     }
-    list($presetname, $style) = split(':', $settings['imagecache_preset']);
+    list($presetname, $style) = explode(':', $settings['imagecache_preset']);
     return theme('fbsmp_photo_attachment_imagecache', array('preset' => $presetname, 'style' => $style, 'attachment' => $attachment, 'alt' => $settings['alt'], 'title' => '', 'attributes' => $attributes));
   }
 
