Closed (fixed)
Project:
ImageCache
Version:
6.x-2.0-beta2
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
8 Nov 2008 at 11:09 UTC
Updated:
3 Jun 2012 at 00:20 UTC
If an profile, which has an image, is updatet, imagecache flushes all presets,
even when the image has not changed.
if ($op == 'update' && !empty($account->picture)) {
imagecache_image_flush($account->picture);
}
To reduce server load, I think it would be better to check if the image has changed.
if($op == 'update') {
//Only flush when the picture ist realy new, or deleted
if($edit['picture'] OR $edit['picture_delete'] == 1) {
imagecache_image_flush($account->picture);
}
}
Nicolas.
Comments
Comment #1
drewish commentedplease roll a patch.
Comment #2
hankpalan.com commentedIs the imagecache flushing the profile pic already and its just a matter of how to do it properly?
I ask this because if I upload a new profile image it doesn't display until I refresh the page. Am I doing something wrong or is that what this issue is about?
Comment #3
drewish commentedhankpalan.com, that's actually a core bug as well. since the image goes into the same place the browser assumes it's the same file.
Comment #4
drewish commentedComment #5
tantenic commentedI've tested the following solution:
in user.module.php on line 426 I have added a timestamp to the destination behind $form['#uid'].
Now, the filename changes on every upload and the browser does not asume the same file.
It works on my local testsite.
Comment #6
drewish commentedI think a better solution might be to just stick the timestamp in the query portion of the link to the image displayed on the edit form. You could probably do that with a form alter rather than hacking core.
Comment #7
tantenic commentedOK, how about this:
If the image is a user-image, the timestamp of the last modification is added to the url.
Now it is no core hack, but It only works, if imagecache ist used to display the picture.
Comment #8
drewish commentedwell now it's a hack in my module... i don't want a special case in there just for user pictures. a form alter for user pictures doesn't seem that unreasonable.
Comment #9
tantenic commentedOK, but the problem is not only on the edit form. The problem is erverwhere the picture is shown. But maybe this is the wrong module to fix that and the wrong issue.
Comment #10
fizk commentedNot sure if this should be fixed in imagecache. Feel free to discuss.