You are here

function _video_image_prepare in Video 5

Same name and namespace in other branches
  1. 6 plugins/video_image/video_image.module \_video_image_prepare()
  2. 6.2 plugins/video_image/video_image.module \_video_image_prepare()
1 call to _video_image_prepare()
video_image_nodeapi in plugins/video_image/video_image.module
Implementation of hook_nodeapi()

File

plugins/video_image/video_image.module, line 239
Enable image support for video module.

Code

function _video_image_prepare(&$node) {

  // let's check that we have a valid image
  if (count($_POST)) {
    $field_name = file_check_upload('image');
    if (!$field_name && video_image_is_autothumbable($node)) {
      _video_image_thumbnail_debug(t('video_image_nodeapi: prepare: ready to thumbnail video'));
      $field_name = module_invoke('video_' . $node->vtype, 'v_auto_thumbnail', $node);
      if ($field_name === false && count($_POST)) {
        drupal_set_message(t('The thumbnailing process of your video failed for some reason. Video thumbnail will not be available.'), 'error');
      }
    }
  }
  if ($field_name) {
    $node->tempimage = _video_image_temp_image_store($field_name);
    $node->new_image = TRUE;
  }
  else {
    if (is_array($_POST['tempimage']) && ($_POST['op'] == 'Preview' || $_POST['op'] == 'Submit')) {
      $node->tempimage = (array) _video_image_temp_image_load(array_values($_POST['tempimage']['fids']));
    }
  }
}