diff options
author | Heshan Wanigasooriya <heshanmw@gmail.com> | 2009-05-27 16:28:27 +0000 |
---|---|---|
committer | Heshan Wanigasooriya <heshanmw@gmail.com> | 2009-05-27 16:28:27 +0000 |
commit | b01e744ce54fa77277cd22febbda8e373207ac5f (patch) | |
tree | 0515d7fd2e83fe3f1c0ac73a560c7418d907623a | |
parent | 8cd94d3aabb438fc8efa275c1b57e44d33e2fac5 (diff) | |
download | video-b01e744ce54fa77277cd22febbda8e373207ac5f.tar.gz video-b01e744ce54fa77277cd22febbda8e373207ac5f.tar.bz2 |
updating video image module
-rw-r--r-- | plugins/video_image/video_image.module | 46 |
1 files changed, 28 insertions, 18 deletions
diff --git a/plugins/video_image/video_image.module b/plugins/video_image/video_image.module index 7e0d82d..f8a3efb 100644 --- a/plugins/video_image/video_image.module +++ b/plugins/video_image/video_image.module @@ -1,12 +1,13 @@ <?php -// $Id$ +//$Id$ /** - * @file video_image.module + * @file + * Enable image support for video module. * - * @author Heshan Wanigasooriya <heshan at heidisoft dot com> - * <heshanmw at gmail dot com> + * @author Fabio Varesano <fvaresano at yahoo dot it> + * porting to Drupal 6 + * @author Heshan Wanigasooriya <heshan at heidisoft.com><heshanmw@gmail.com> * @todo - * implement the help of the video upload (Implement the internal hook for the help video_upload_v_help()). */ @@ -178,7 +179,6 @@ function video_image_form_alter(&$form, &$form_state, $form_id) { function video_image_nodeapi(&$node, $op, $teaser) { //print_r($op); //exit; - //db_query("INSERT INTO {op} (id, name) VALUES (%d, '%s')", NULL, $op); if($node->type == 'video') { switch ($op) { case 'load': @@ -192,7 +192,7 @@ function video_image_nodeapi(&$node, $op, $teaser) { case 'presave': //exit; - _video_image_presave($node); + _video_image_submit($node); break; case 'view': @@ -273,9 +273,11 @@ function _video_image_prepare(&$node) { } } -function _video_image_presave(&$node) { - - // ############# PREPARE ####################### +function _video_image_submit(&$node) { + //print_r($node); + //exit; + // ############# PREPARE ####################### + // ------------- MOVED ------------------------- if (count($_POST)) { $validators = array( @@ -293,7 +295,19 @@ function _video_image_presave(&$node) { } if ($field_name) { - + /* + if($node->iid){ + + // Remove all the existing images. + $result = db_query("SELECT f.fid, f.filepath FROM {image} i INNER JOIN {files} f ON i.fid = f.fid WHERE i.nid = %d", $node->iid); + while ($file = db_fetch_object($result)) { + file_delete(file_create_path($file->filepath)); + db_query("DELETE FROM {files} WHERE fid = %d", $file->fid); + } + //db_query("DELETE FROM {image} WHERE nid = %d", $node->iid); + } + * + */ $node->tempimage = _video_image_temp_image_store($field_name); $node->new_image = TRUE; //print_r($node); @@ -416,11 +430,8 @@ function _video_image_thumbnail_debug($msg) { } function _video_image_temp_image_store(&$file) { - // Update the node to reflect the actual filename, it may have been changed - $image = new stdClass(); $image->images[IMAGE_ORIGINAL] = $file->filepath; - //using image module $image->images =_image_build_derivatives($image); $image->type = 'image'; $image->uid = 1; @@ -440,12 +451,11 @@ function _video_image_temp_image_store(&$file) { // save the images in the files table foreach ($image->images as $l => $f) { $info = image_get_info($f); - $original_path = $node->images[IMAGE_ORIGINAL]; - if (file_move($file->filepath, _image_filename($original_path, $size))) { - $file->fid = db_last_insert_id('files','fid'); + $file->fid = db_last_insert_id('files','fid'); + if($l=="_original"){ db_query("INSERT INTO {files} (fid, filename, filepath, filemime, filesize) VALUES (%d, '%s', '%s', '%s', '%s')", $fid, "video_image_temp.$l", $f, $info['mime_type'], $info['file_size']); - } + } $image->fids[$l] = $file->fid; } } |