/[drupal]/contributions/modules/video/plugins/video_image/video_image.module
ViewVC logotype

Diff of /contributions/modules/video/plugins/video_image/video_image.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.15.2.7, Sat Nov 7 17:00:51 2009 UTC revision 1.15.2.8, Sun Nov 8 15:41:54 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2  //$Id: video_image.module,v 1.15.2.6 2009/10/01 15:00:59 heshanmw Exp $  //$Id: video_image.module,v 1.15.2.7 2009/11/07 17:00:51 heshanmw Exp $
3  /**  /**
4   * @file   * @file
5   * Enable image support for video module.   * Enable image support for video module.
# Line 308  function _video_image_presave(&$node) { Line 308  function _video_image_presave(&$node) {
308      if (!$field_name && video_image_is_autothumbable($node)) {      if (!$field_name && video_image_is_autothumbable($node)) {
309        _video_image_thumbnail_debug(t('video_image_nodeapi: prepare: ready to thumbnail video'));        _video_image_thumbnail_debug(t('video_image_nodeapi: prepare: ready to thumbnail video'));
310        $field_name = module_invoke('video_' . $node->vtype, 'v_auto_thumbnail', $node);        $field_name = module_invoke('video_' . $node->vtype, 'v_auto_thumbnail', $node);
311    //      echo 'ok';
312    //      print_r($field_name);
313    //      exit;
314        if ($field_name === false && count($_POST)) {        if ($field_name === false && count($_POST)) {
315          drupal_set_message(t('The thumbnailing process of your video failed for some reason. Video thumbnail will not be available.'), 'error');          drupal_set_message(t('The thumbnailing process of your video failed for some reason. Video thumbnail will not be available.'), 'error');
316       }       }
# Line 330  function _video_image_presave(&$node) { Line 333  function _video_image_presave(&$node) {
333         */         */
334      $node->tempimage = _video_image_temp_image_store($field_name);      $node->tempimage = _video_image_temp_image_store($field_name);
335      $node->new_image = TRUE;      $node->new_image = TRUE;
336      //print_r($node);  //    print_r($node);
337      //die;  //    die;
338    } else if (is_array($_POST['tempimage']) && ($_POST['op'] == 'Preview' || $_POST['op'] == 'Submit')) {    }
339      else if (is_array($_POST['tempimage']) && ($_POST['op'] == 'Preview' || $_POST['op'] == 'Submit')) {
340          //print_r($node);          //print_r($node);
341    //exit;    //exit;
342      $node->tempimage = (array)_video_image_temp_image_load(array_values($_POST['tempimage']['fids']));      $node->tempimage = (array)_video_image_temp_image_load(array_values($_POST['tempimage']['fids']));
# Line 356  function _video_image_presave(&$node) { Line 360  function _video_image_presave(&$node) {
360      //        implode(',', array_values($node->tempimage['fids'])));      //        implode(',', array_values($node->tempimage['fids'])));
361    
362      // initialize standard node fields      // initialize standard node fields
363      //print_r($image);  //    print_r($image);
364      //exit;  //    exit;
365      $image->uid = $node->uid;      $image->uid = $node->uid;
366      $image->created = time();      $image->created = time();
367      $image->title = t('Video thumbnail for !title', array('!title' => $node->title));      $image->title = t('Video thumbnail for !title', array('!title' => $node->title));
# Line 380  function _video_image_presave(&$node) { Line 384  function _video_image_presave(&$node) {
384        node_save($oldimage);        node_save($oldimage);
385        $node->iid = $oldimage->nid;        $node->iid = $oldimage->nid;
386        $node->serial_data['iid'] = $node->iid;        $node->serial_data['iid'] = $node->iid;
387      } else {      }
388        else {
389        node_save($image);        node_save($image);
390    
391        //print_r($image);        //print_r($image);
# Line 480  function _video_image_temp_image_store(& Line 485  function _video_image_temp_image_store(&
485        foreach ($image->images as $l => $f) {        foreach ($image->images as $l => $f) {
486          $info = image_get_info($f);          $info = image_get_info($f);
487          $file->fid = db_last_insert_id('files','fid');          $file->fid = db_last_insert_id('files','fid');
488          if($l=="_original") { // #556546 by linuxbox          if($l == "_original") { // #556546 by linuxbox
489            if ($fid) {            if ($fid) {
490              db_query("INSERT INTO {files} (fid, filename, filepath, filemime, filesize) VALUES (%d, '%s', '%s', '%s', '%s')",              db_query("INSERT INTO {files} (fid, filename, filepath, filemime, filesize) VALUES (%d, '%s', '%s', '%s', '%s')",
491                  $fid, "video_image_temp.$l", $f, $info['mime_type'], $info['file_size']);                  $fid, "video_image_temp.$l", $f, $info['mime_type'], $info['file_size']);
492            } else {            }
493              else {
494              db_query("INSERT INTO {files} (filename, filepath, filemime, filesize) VALUES ('%s', '%s', '%s', '%s')",              db_query("INSERT INTO {files} (filename, filepath, filemime, filesize) VALUES ('%s', '%s', '%s', '%s')",
495                  "video_image_temp.$l", $f, $info['mime_type'], $info['file_size']);                  "video_image_temp.$l", $f, $info['mime_type'], $info['file_size']);
496            }            }
# Line 553  function _video_image_publish_thumbnails Line 559  function _video_image_publish_thumbnails
559   * Create an image file object from a given image url   * Create an image file object from a given image url
560  */  */
561  function _video_image_get_thumb_file_object($thumbnail_url, $id) {  function _video_image_get_thumb_file_object($thumbnail_url, $id) {
562    //  echo $thumbnail_url;
563    if($thumbnail_url && $thumbnail_url != '' && $image = image_gd_open($thumbnail_url, 'jpeg')) {  //  exit;
564      //if($thumbnail_url && $thumbnail_url != '' && $image = image_gd_open($thumbnail_url, 'jpeg')) {
565      if($thumbnail_url && $thumbnail_url != '' && $image = image_toolkit_invoke('open', array($thumbnail_url, 'jpeg'))) {
566        //image_toolkit_invoke('open', array($back_image, $info['extension']));
567      // save image to temp directory for processing      // save image to temp directory for processing
568      $location = file_directory_temp() .'/'. $id .'.jpg';      $location = file_directory_temp() .'/'. $id .'.jpg';
569      image_gd_close($image, $location, 'jpeg');      image_gd_close($image, $location, 'jpeg');

Legend:
Removed from v.1.15.2.7  
changed lines
  Added in v.1.15.2.8

  ViewVC Help
Powered by ViewVC 1.1.2