function _video_image_prepare in Video 6.2
Same name and namespace in other branches
- 5 plugins/video_image/video_image.module \_video_image_prepare()
- 6 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 271 - Enable image support for video module.
Code
function _video_image_prepare(&$node) {
// let's check that we have a valid image
if (count($_POST)) {
$validators = array(
'file_validate_is_image' => array(),
);
$field_name = file_save_upload('image', $validators);
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']));
}
}
}