Index: imagecache_profiles.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache_profiles/imagecache_profiles.info,v
retrieving revision 1.4
diff -u -p -r1.4 imagecache_profiles.info
--- imagecache_profiles.info	27 Jul 2010 23:09:54 -0000	1.4
+++ imagecache_profiles.info	8 Dec 2010 23:20:33 -0000
@@ -5,3 +5,4 @@ core = 7.x
 dependencies[] = image
 files[] = imagecache_profiles.install
 files[] = imagecache_profiles.module
+files[] = views/imagecache_profiles_handler_field_user_picture.inc
Index: imagecache_profiles.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache_profiles/imagecache_profiles.module,v
retrieving revision 1.18
diff -u -p -r1.18 imagecache_profiles.module
--- imagecache_profiles.module	28 Jul 2010 02:01:55 -0000	1.18
+++ imagecache_profiles.module	8 Dec 2010 23:20:34 -0000
@@ -54,11 +54,14 @@ function imagecache_profiles_preprocess_
       $style = $account->user_picture_style;
     }
 
-    if (isset($filepath) && !empty($style) && $style != variable_get('user_picture_style', '')) {
+    if (isset($filepath) && file_valid_uri($filepath) && !empty($style) && $style != variable_get('user_picture_style', '')) {
       $alt = t("@user's picture", array('@user' => format_username($account)));
-      $variables['user_picture'] = theme('image_style', array('style_name' => $style, 'path' => $filepath, 'alt' => $alt, 'title' => $alt, 'getsize' => FALSE));
+      $variables['user_picture'] = theme('image_style', array('style_name' => $style, 'path' => $filepath, 'alt' => $alt, 'title' => $alt));
       if (!empty($account->uid) && user_access('access user profiles')) {
-        $attributes = array('attributes' => array('title' => t('View user profile.')), 'html' => TRUE);
+        $attributes = array(
+          'attributes' => array('title' => t('View user profile.')),
+          'html' => TRUE,
+        );
         $variables['user_picture'] = l($variables['user_picture'], "user/$account->uid", $attributes);
       }
     }
@@ -197,12 +200,14 @@ function imagecache_profiles_node_view(&
 
 /**
  * Implements hook_views_api().
- *
- * Not tested.
  */
 function imagecache_profiles_views_api() {
-  return array(
-    'api' => 2,
-    'path' => drupal_get_path('module', 'imagecache_profiles') .'/views',
-  );
+  return array('api' => 2);
+}
+
+/**
+ * Implements hook_views_data_alter().
+ */
+function imagecache_profiles_views_data_alter(&$data) {
+  $data['users']['picture']['field']['handler'] = 'imagecache_profiles_handler_field_user_picture';
 }
Index: views/imagecache_profiles.views.inc
===================================================================
RCS file: views/imagecache_profiles.views.inc
diff -N views/imagecache_profiles.views.inc
--- views/imagecache_profiles.views.inc	28 Aug 2009 07:32:08 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
-<?php
-// $Id: imagecache_profiles.views.inc,v 1.1 2009/08/28 07:32:08 andypost Exp $
-
-function imagecache_profiles_views_handlers() {
-  return array(
-    'info' => array(
-      'path' => drupal_get_path('module', 'imagecache_profiles') .'/views',
-    ),
-    'handlers' => array(
-      'imagecache_profiles_handler_field_user_picture' => array(
-        'parent' => 'views_handler_field_user_picture',
-      ),
-    ),
-  );
-}
-
-function imagecache_profiles_views_data_alter(&$data) {
-  $data['users']['picture']['field']['handler'] = 'imagecache_profiles_handler_field_user_picture';
-}
Index: views/imagecache_profiles_handler_field_user_picture.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache_profiles/views/imagecache_profiles_handler_field_user_picture.inc,v
retrieving revision 1.5
diff -u -p -r1.5 imagecache_profiles_handler_field_user_picture.inc
--- views/imagecache_profiles_handler_field_user_picture.inc	24 Mar 2010 17:46:33 -0000	1.5
+++ views/imagecache_profiles_handler_field_user_picture.inc	8 Dec 2010 23:20:34 -0000
@@ -13,16 +13,11 @@ class imagecache_profiles_handler_field_
 
   function options_form(&$form, &$form_state) {
     parent::options_form($form, $form_state);
-    $presets = imagecache_presets();
-    $opt = array('' => '');
-    foreach ($presets as $preset) {
-      $opt[$preset['presetname']] = check_plain($preset['presetname']);
-    }
     $options = $this->options;
     $form['imagecache_preset'] = array(
       '#title' => t('Imagecache preset'),
       '#type'  => 'select',
-      '#options' => $opt,
+      '#options' => image_style_options(TRUE),
       '#default_value' => $options['imagecache_preset'],
     );
   }
@@ -36,10 +31,12 @@ class imagecache_profiles_handler_field_
     $account->mail = isset($values->{$this->aliases['mail']}) ? $values->{$this->aliases['mail']} : '';
     $account->picture = $values->{$this->field_alias};
 
+    $variables['account'] = $account;
+
     if ($options['imagecache_preset']) {
-      $account->imagecache_preset = $options['imagecache_preset'];
+      $variables['user_picture_style'] = $options['imagecache_preset'];
     }
 
-    return theme('user_picture', $account);
+    return theme('user_picture', $variables);
   }
 }
