You are here

function adaptive_image_menu in Adaptive Image 7

Implements hook_menu().

File

./adaptive_image.module, line 38
Adaptive Image - Adaptive images for Drupal

Code

function adaptive_image_menu() {
  $items = array();

  // Add image style generation paths adaptive URLs.
  if (module_exists('image')) {

    // Generate and deliver image derivatives of public files.
    $directory_path = file_stream_wrapper_get_instance_by_scheme('public')
      ->getDirectoryPath();
    $items[$directory_path . '/styles/%image_style/adaptive-image'] = array(
      'title' => 'Generate image style',
      'page callback' => 'adaptive_image_style_deliver',
      'page arguments' => array(
        count(explode('/', $directory_path)) + 1,
      ),
      'access callback' => TRUE,
      'type' => MENU_CALLBACK,
      'file' => 'adaptive_image.image.inc',
    );

    // Generate and deliver image derivatives of private files.
    $items['system/files/styles/%image_style/adaptive-image'] = array(
      'title' => 'Generate adaptive image style',
      'page callback' => 'adaptive_image_style_deliver',
      'page arguments' => array(
        3,
      ),
      'access callback' => TRUE,
      'type' => MENU_CALLBACK,
      'file' => 'adaptive_image.image.inc',
    );
  }
  return $items;
}