You are here

function scald_flash_scald_add_form_fill in Scald: Media Management made easy 7

Implements hook_scald_add_form_fill.

File

modules/providers/scald_flash/scald_flash.module, line 43
Defines a flash provider for Scald.

Code

function scald_flash_scald_add_form_fill(&$atoms, $form, $form_state) {
  foreach ($atoms as $delta => $atom) {
    if (is_array($form_state['values']['file_swf']) && module_exists('plupload')) {
      module_load_include('inc', 'scald', 'includes/scald.plupload');
      $file = scald_plupload_save_file($form_state['values']['file_swf'][$delta]['tmppath'], $form['file_swf']['#upload_location'] . $form_state['values']['file_swf'][$delta]['name']);
    }
    else {
      $file = file_load($form_state['values']['file_swf']);
    }
    $atom->title = $file->filename;
    $atom->base_id = $file->fid;
    $size_infos = getimagesize($file->uri);
    $atom->data['flash_width'] = $size_infos[0];
    $atom->data['flash_height'] = $size_infos[1];
    $langcode = field_language('scald_atom', $atom, 'scald_width');
    $atom->scald_width[$langcode][0]['value'] = $size_infos[0];
    $atom->scald_height[$langcode][0]['value'] = $size_infos[1];
  }
}