6) Pictures no longer work in my profiles
a) Defined imagecache presets
b) Applied it to the pictures
c) Flushed the cache
d) Now pictures don’t work and it doesn’t look like they get uploaded anywhere.
e) Changed permission of imagecache and file directory to 777 to see if this is the issue (it is not).

Any thoughts?
Thanks!

Comments

dopry’s picture

Priority: Critical » Normal
Status: Active » Postponed (maintainer needs more info)

Can you please provide directions to reproduce your issue. You description is too vague.

socialnicheguru’s picture

Yes.

I have been trying to use imagecache presets on images.

I create the preset once and goback to my content type and apply the preset to the image.

I can view it fine.

I get the problem when I try to either upload another picture or delete the one that I have. The presets are deleted and they are not recreated no matter what I do.

I tried to change permissions to the image cache folder to 777
I tried deleting and recreating imagecache presets. But I cannot get any other presets to be created.
I have public folders checked under file system and clean URLs checked

dopry’s picture

Okay so I'm not a mind reader....

I have been trying to use imagecache presets on images.
I don't know that presets are tools or how you would use them, or on what images. Can you describe what you are doing with imagecache presets. Exactly what you do, what you expect, and what you observe?

I create the preset once and goback to my content type and apply the preset to the image.
huh? again. Are you talking about going to admin/imagecache and creating a preset? By apply it to a preset just how do you do that?

I get the problem when I try to either upload another picture or delete the one that I have. The presets are deleted and they are not recreated no matter what I do.
You mean the presets themselves are deleted or the derivate images are deleted? How do you upload a new picture or delete the one that you have?

How is your imagefield configured? How are your presets configured?

panis’s picture

I know what is going on... (not a mind reader I am mind you ;-)) and can offer you a small patch.. Problem is that user profile picture uploads are always stored as "picture-.ext". So if I upload an image - then call

theme('imagecache', 'custom_size', $user->picture); to display it - the first time this is called the picture does not exist in the imagecache and gets recreated fine..

Now I upload another picture - however this one is still stored under the same name as before and imagecache does not realize that the source image has changed and since the cache already contains a file of the same name it serves up the old file.

Several options to fix this
a) flush the cache for the user picture when the user gets modified in hook_user in a custom module..
b)

function theme_imagecache()  {
...
$source = realpath($path);
$cached = realpath(file_create_directory() .'/imagecache/'. $namespace .'/'. $path);
$stime = filemtime($source);
$ctime = filemtime($cached);
//check stime and ctime to make sure the file exists or else - to prevent temporary race conditions
if ($stime > $ctime && $stime && $ctime) {
  imagecache_flush...
}

c) override the imagecache theme in your local file...

greg@beargroup.com’s picture

Hey @panis thanks a lot for the post... posted the same issue here, http://drupal.org/node/232240 with a couple things I was trying.

Solution I had there was not working for me - so will give yours a shot. One of these recommended over another? There is a whole module imagecache_profiles that seems to try to deal with this issue - but it would be great if imagecache "knew" about the idiosyncrasies of drupals user profile images and flushed itself.

-Greg

dopry’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

There is a module for this... http://drupal.org/project/imagecache_profiles

greg@beargroup.com’s picture

Doesn't work with image_cache 2.0 yet -- and all its doing is a cache reset if its a user_profile image. I'd have to think a lot of people use image cache for this to set exact user profile image sizes - I've done it on a couple sites now.

I guess I'm really asking if you'd consider putting this cache reset in the main module if its a user_profile image coming through?

-Greg