Great little module. Missing some documentation but no rush.

When uploading an image, after cropping, when I'm back to the user page, the original image shows up. After refreshing the page, the cropped image shows up.

It should need to be refreshed to show up correctly.

Too bad that this is not a DEV version, as it is obviously not bug free.

Comments

Anonymous’s picture

woups, I meant:

" It shouldn't need to be refreshed to show up correctly. "

alex.k’s picture

Confirmed; it looks like a browser caching issue, as if I view just the image, it will be the old one until it is reloaded. Perhaps the image file could be renamed with a timestamp or a random string, so that the old one is not used.

hhunter’s picture

You can override template_preprocess_user_picture() to accomplish this... it's a bit overkill as it'll go to the server for every user picture on the site, every time. But it's a start:

function template_preprocess_user_picture(&$variables) {
  $variables['picture'] = '';
  if (variable_get('user_pictures', 0)) {
    $account = $variables['account'];
    if (!empty($account->picture) && file_exists($account->picture)) {
      $picture = file_create_url($account->picture);
    }
    else if (variable_get('user_picture_default', '')) {
      $picture = variable_get('user_picture_default', '');
    }

    // add a random string to the end of image filenames to prevent browser caching
    $picture .= '?' . time();

    if (isset($picture)) {
      $alt = t("@user's picture", array('@user' => $account->name ? $account->name : variable_get('anonymous', t('Anonymous'))));
      $variables['picture'] = theme('image', $picture, $alt, $alt, '', FALSE);
      if (!empty($account->uid) && user_access('access user profiles')) {
        $attributes = array('attributes' => array('title' => t('View user profile.')), 'html' => TRUE);
        $variables['picture'] = l($variables['picture'], "user/$account->uid", $attributes);
      }
    }
  }
}
rbl’s picture

Subscribing

rbl’s picture

Has anyone done any progress on this?

I tried a few things but I lack the necessary coding skills to pull it off. I see 3 options:
- rename the file;
- alter the timestamp (touch);
- both.

Hhunter's solution seems rather overkill if you consider a website where post and comments have user pictures...

Ricardo

petertj’s picture

I am also experiencing this problem, but only on IE (v7) - not FF, Safari or Chrome.

But sadly, most of our users are on IE, so I can't deploy this module. Too bad, it is a really big improvement over the default flow.

adeel.iqbal’s picture

Status: Active » Closed (fixed)

Resolved in later versions.