? 866428-comment-preview-D6.patch
? 866428-imagecacheprofiles-comment-preview-D6_0.patch
Index: imagecache_profiles.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagecache_profiles/imagecache_profiles.module,v
retrieving revision 1.4.2.17
diff -u -p -r1.4.2.17 imagecache_profiles.module
--- imagecache_profiles.module	27 Jul 2010 18:27:04 -0000	1.4.2.17
+++ imagecache_profiles.module	27 Jul 2010 21:02:11 -0000
@@ -31,10 +31,6 @@ function imagecache_profiles_preprocess_
       // Manually set preset (e.g. Views)
       $preset = $account->imagecache_preset;
     }
-    elseif (!empty($account->cid) && variable_get('user_picture_imagecache_comments', 0)) {
-      // Comment user picture preset.
-      $preset = variable_get('user_picture_imagecache_comments', 0);
-    }
     elseif (variable_get('user_picture_imagecache_profiles_default', 0)) {
       // Default user picture preset.
       $preset = variable_get('user_picture_imagecache_profiles_default', 0);
@@ -43,7 +39,7 @@ function imagecache_profiles_preprocess_
     if (!empty($account->picture) && file_exists($account->picture)) {
       $picture = $account->picture;
     }
-    else if (variable_get('user_picture_default', '')) {
+    elseif (variable_get('user_picture_default', '')) {
       $picture = variable_get('user_picture_default', '');
     }
 
@@ -266,12 +262,26 @@ function imagecache_profiles_user($op, &
  * Change the user profile user picture to use the preferred imagecache preset.
  */
 function imagecache_profiles_profile_alter(&$account) {
-  if (isset($account->content['user_picture']) && $preset = variable_get('user_picture_imagecache_profiles', 0)) {
+  if (isset($account->content['user_picture']['#value']) && $preset = variable_get('user_picture_imagecache_profiles', 0)) {
     $account->imagecache_preset = $preset;
-    $account->content['user_picture'] = array(
-      '#value' => theme('user_picture', $account),
-      '#weight' => -10,
-    );
+    $account->content['user_picture']['#value'] = theme('user_picture', $account);
+  }
+}
+
+/**
+ * Implements hook_comment().
+ *
+ * Change comment user pictures to use the preferred imagecache preset.
+ */
+function imagecache_profiles_comment(&$comment, $op) {
+  if ($op == 'view' && theme_get_setting('toggle_comment_user_picture')) {
+    // If this is a comment preview, we need to manually add $comment->picture.
+    if (!empty($comment->uid) && !isset($comment->picture)) {
+      $comment->picture = db_result(db_query("SELECT picture FROM {users} WHERE uid = %d", $comment->uid));
+    }
+    if ($preset = variable_get('user_picture_imagecache_comments', 0)) {
+      $comment->imagecache_preset = $preset;
+    }
   }
 }
 
