Fix for Fix for change CCK field path in Rules when node is saved - use Custom PHP

  1. I put my own queries into the Custom PHP field
  2.  
  3. //this is the path to the actual uploaded to pass to the encoding.com script
  4. $_SESSION['videoup'] = '[node:field_video-filefield-filepath]';
  5.  
  6. //update video file path to directory holding transcoded files
  7. $vpath = '[node:field_video-filefield-filepath]';
  8. $vfid = [node:field_video-filefield-fid];
  9. $lastslash = strripos($vpath,'/') + 1;
  10. $justfile = substr($vpath,$lastslash);
  11. $vfilepath = "sites/default/files/transcoded/$justfile.flv";
  12. db_query("UPDATE files SET filepath = '$vfilepath' WHERE fid = $vfid");
  13.  
  14. //update thumbnail file path to directory holding transcoded files
  15. $tpath = $vpath;
  16. $tfid = [node:field_thumbnail-filefield-fid];
  17. $lastslash = strripos($tpath,'/') + 1;
  18. $justfile = substr($tpath,$lastslash);
  19. $tfilepath = "sites/default/files/transcoded/$justfile.jpg";
  20. db_query("UPDATE files SET filepath = '$tfilepath' WHERE fid = $tfid");

Submit Fix

Any tags you'd like to associate with your code, delimitered by commas (example: Views, CCK, Module, etc).
Select the syntax highlighting mode to use.