You are here

function scald_image_scald_provider in Scald: Media Management made easy 6

Implementation of hook_scald_provider().

1 call to scald_image_scald_provider()
scald_image_update_6001 in scald_image/scald_image.install
Implements hook_update_N(). Converts our imagecache based transcoders to use the presetname instead of the presetid as a key. This is more robust to change such as putting presets in code.

File

scald_image/scald_image.module, line 17

Code

function scald_image_scald_provider() {
  $provides = array(
    'atoms' => array(),
    'transcoders' => array(),
  );

  // Ensure that the non-bootstrap list of modules is used.  The hit to rebuild
  //  the list should be minimal because this function should be executing very
  //  rarely.
  module_list(TRUE, FALSE);

  // Conditionally declare possible Base Entities for Atom Provider
  if (module_exists('upload')) {
    if (!is_array($provides['atoms']['image'])) {
      $provides['atoms']['image'] = array();
    }
    $provides['atoms']['image'][] = t('Files attached to Nodes.');
  }
  if (module_exists('filefield')) {
    if (!is_array($provides['atoms']['image'])) {
      $provides['atoms']['image'] = array();
    }
    $provides['atoms']['image'][] = t('Filefield files from CCK Fields.');
  }
  if (module_exists('imagefield')) {
    if (!is_array($provides['atoms']['image'])) {
      $provides['atoms']['image'] = array();
    }
    $provides['atoms']['image'][] = t('Images from imagefield CCK Fields.');
  }

  // Conditionally Provide Imagecache-based Transcoders
  if (module_exists('imagecache')) {

    // Provide ability to filter available presets ?
    foreach (imagecache_presets() as $id => $preset) {
      $provides['transcoders']['imagecache-' . $preset['presetname']] = array(
        'title' => $preset['presetname'] . ' (ImageCache preset)',
        'description' => "Uses the ImageCache preset {$preset['presetname']} to prepare the image.",
        'formats' => array(
          'image' => 'passthrough',
          'audio' => 'passthrough',
          'video' => 'passthrough',
        ),
      );
    }
  }
  return $provides;
}