function _image_node_form_submit in Image FUpload 6.2
Same name in this branch
- 6.2 image_fupload.module \_image_node_form_submit()
- 6.2 image_fupload_image/image_fupload_image.module \_image_node_form_submit()
Same name and namespace in other branches
- 6.3 image_fupload_image/image_fupload_image.module \_image_node_form_submit()
- 6 image_fupload_image/image_fupload_image.module \_image_node_form_submit()
Helper function which emulates "image_node_form_submit" of image.module v 1.274 2008/06/16 18:45:58 drewish Need this because the static variable "$upload_cache" doesn't seem to persist after execution of "form_execute_handlers" function
2 string references to '_image_node_form_submit'
- image_fupload_form_alter in ./
image_fupload.module - Implementation of hook_form_alter() registry.
- image_fupload_image_form_alter in image_fupload_image/
image_fupload_image.module - Implementation of hook_form_alter() registry.
File
- ./
image_fupload.module, line 290
Code
function _image_node_form_submit($form, &$form_state) {
global $file_cache;
$nid = 'new_node';
// in this case, we can define it permanentelly
$file = $file_cache['image'];
// fill our object with picture information
// Code from image.module v 1.274 2008/06/16 18:45:58 drewish (line 199++)
$image_info = image_get_info($file->filepath);
$aspect_ratio = $image_info['height'] / $image_info['width'];
$original_size = image_get_sizes(IMAGE_ORIGINAL, $aspect_ratio);
if (!empty($original_size['width']) && !empty($original_size['height'])) {
$result = image_scale($file->filepath, $file->filepath, $original_size['width'], $original_size['height']);
if ($result) {
clearstatcache();
$file->filesize = filesize($file->filepath);
drupal_set_message(t('The original image was resized to fit within the maximum allowed resolution of %width x %height pixels.', array(
'%width' => $original_size['width'],
'%height' => $original_size['height'],
)));
}
}
// We're good to go.
$form_state['values']['images'][IMAGE_ORIGINAL] = $file->filepath;
$form_state['values']['rebuild_images'] = FALSE;
$form_state['values']['new_file'] = TRUE;
// Call hook to allow other modules to modify the original image.
module_invoke_all('image_alter', $form_state['values'], $file->filepath, IMAGE_ORIGINAL);
$form_state['values']['images'] = _image_build_derivatives((object) $form_state['values'], TRUE);
// Store the new file into the session.
$_SESSION['image_new_files'][$nid] = $form_state['values']['images'];
}