As spoken to you in the IRC iam currently implementing a new private file API which should be generally working with any kind of files uploaded with the file api. Acually as imagecache is accessing those files on the file-system base, no callbacks can be used here to stop it, when access is not granted.

Similar to the current private file implementation in imagecache, i added a hook_alter for even modifing that prefix. This way other module can force imagecache to use there callback to render the file, where they can use access checks for stoping imagecache if needed.

Patch attached, thanks for your time drewish

CommentFileSizeAuthor
#2 imagecache.patch1.53 KBeugenmayer
imagecache.patch1.56 KBeugenmayer

Comments

eugenmayer’s picture

The real implementation of this API to add imagecache support in my file api in a submodule looks like this: http://pastebin.com/kg4ETV3z

The imagecache related part starts on #41

eugenmayer’s picture

StatusFileSize
new1.53 KB

Fixed docs example

eugenmayer’s picture

Ah sorry, me was wrong. The patch does not include the absolute path url fix, but it will conflice with it. nevertheless it should be easy to resolve

eugenmayer’s picture

Merge conflict would be on

case FILE_DOWNLOADS_PUBLIC:
      $prefix_path = $base. file_directory_path();	
      break;

Just use the line of this patch so it looks like above, the patch for the $base is included one line above.

eugenmayer’s picture

Status: Active » Reviewed & tested by the community
marcoka’s picture

i suggest to give $presetname in drupal_alter too. You could then check an array of protected presets and create only the protected ones in /privatefiles

drupal_alter('imagecache_prefixpath', $prefix_path, $filepath, $presetname, $absolute);

YK85’s picture

subscribing

drewish’s picture

Status: Reviewed & tested by the community » Fixed

I think equivalent behavior can be achieved by using #570132: Support CDN rewriting of ImageCache paths. I'm going to take that approach because it's compatible with what D7 does and PressFlow is doing in D6.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.