Hi,
I flushed my imagecache_external, then default/files/imagecache is removed.
1) When I start filling next to:
default/files/styles also
default/files/imagecache is being build.

2) Next to this I can't remove old externals made on:
sites/default/files/styles/thumbnail/public/imagecache/externals
Do you have a method for removal please?

Thanks a lot in advance.
greetings, Martijn

Comments

summit’s picture

Hi,
Diggin into this I see default/files/imagecache is intended behaviour, see code:


function imagecache_external_generate_path($url, $preset) {
  // Create the extenal images directory and ensure it's writable.
  $hash       = md5($url);
  $scheme     = file_default_scheme();
  $directory  = $scheme . '://imagecache/externals';
  if(file_prepare_directory($directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS)) {
    if (file_exists($directory. '/' . $hash)) {
      return $directory. '/' . $hash;
    }
    $file = imagecache_external_fetch($url, $directory . '/' . $hash);
    if ($file) {
      return $file->uri;
    }
  }
  //we couldn't get the file
  return FALSE;
}

But somehow also under this folder the imagecache_external pictures are loaded:

sites/default/files/styles/thumbnail/public/imagecache/externals

Could this have to do with this patch: http://drupal.org/node/1356648#comment-5311114 ?
Greetings, Martijn

BarisW’s picture

Priority: Normal » Major
Status: Active » Needs work

I think it would be a good thing to keep the $preset in the $directory. Else, the cached files are overwritten if you use several image styles to display the same image.

Rest of the patch is great, and solves my problem.

BarisW’s picture

Priority: Major » Normal
Status: Needs work » Active

Ignore my comment, posted in the wrong thread.

BarisW’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

The original images are saved into the /imagecache/externals subfolder within your files directory.
When generating images, Drupal saves the cached images into /styles folder.

The reason that you cannot remove the subfolders in the /styles folder is that this folder has been made by apache, which is a different user that you, as OS user.
Try changing the permissions of the folder before removing it, or use the "sudo" command.

I will make the imagecache/externals folder optional in the admin section per #2145241: Make the image folder configurable.