From where comes $scheme argument in image_style_deliver callback? In core image.module there is a menu item:

  $directory_path = file_stream_wrapper_get_instance_by_scheme('public')-&gt;getDirectoryPath();
  $items[$directory_path . '/styles/%image_style'] = array(
    'title' =&gt; 'Generate image style',
    'page callback' =&gt; 'image_style_deliver',
    'page arguments' =&gt; array(count(explode('/', $directory_path)) + 1),
    'access callback' =&gt; TRUE,
    'type' =&gt; MENU_CALLBACK,
  );


As you can see, there is only one argument passed to it. But when we see "image_style_deliver" function, we see:

function image_style_deliver($style, $scheme) {


I don't know if I'm tired or what but... from where $scheme argument comes from? ;)
Drupal passes on extra portions of the URL as parameters by default. So for example, a URL might look like this:

http://example.com/sites/default/files/styles/style_name/public/foo/bar.jpg

Which resolves in image_style_deliver to

$style = 'style_name';
$schema = 'public';


The function then goes on to extract the rest of the unnamed arguments, and reconstitutes them to form the eventual path to the file.