hook_file_download and style images According this bug issue,
hook_file_download is called twice when private style image is requested. The first time is requested original image without style and then the style image is called. Is there any workaround to skip checking access of original image? 

In particular, I have a website, where user can share his private images on his facebook account. Then I need to allow facebook to send http request to download image. The problem is, that facebook hs limitations on size of images. Facebook doeasn't accept larger images when downloading thumbnails from my website. As I tested it, although my image thumbnails are small, drupal system check access against large original image so facebook doesn't accept the thumbnail. 

Is there any workaround, how could I solve this problem?

thanks for advice
Tomas
Disclaimer - Use this method at your own risk, it has security implications if you don't set up and test it properly :)

A quick and dirty way to override that functionality would be to implement hook_module_implements_alter(), remove the image module's implementation of hook_file_download(), and then implement your own version which has the desired logic. e.g.

function MYMODULE_module_implements_alter(&amp;$implementations, $hook) {
  if ($hook == 'file_download') {
    unset($implementations['image']);
  }
}

function MYMODULE_file_download($uri) {
  // Copy the code from image_file_download() and alter as required.
}