share
Drupal AnswersAccess denied for image styles
[0] [0] Bob
[2011-11-08 19:47:52]
[ 7 hooks imagecache image-styles ]
[ http://drupal.stackexchange.com/questions/15049/access-denied-for-image-styles ] [DELETED]

I was playing with a test module using hook_file_download [1] and hook_file_download_access [2] to see how file access works, and somehow I've managed to deny access to every image style on the site.

The module I enabled looked like:

function testymod_file_download($uri){
    return NULL;
}

function testymod_file_download_access($field, $entity_type, $entity){
    return node_access('view', $entity);
}

With the proper -1 / FALSE returns put in temporary, then removed when I noticed the issue. I suppose it's possible some other change I made that I forgot about has caused this, but it certainly seemed like after playing with the module the site ended up where it is.

Now all the images show up blank, and accesing one using something like:

/system/files/styles/<image_style>/private/<image>.jpg

the page shows access denied (using the appropriate themes/etc). Occasionally it will say access denied, and then proceed to spit out what looks like an HTML mangled representation of the characters in the jpg file after the closing html tag.

I've tried removing the hooks from the module, disabling the module, and changing the hooks to use what I believe is the default values, to no avail. Is there something simple I'm missing here?

edit It seems I can get things working by changing the download to public instead of private in /admin/config/media/file-system... What's going on there?