Author Topic: ExifTool PHP Fast Processing Script using StayOpen and Gearman  (Read 46940 times)

TSM

  • Full Member
  • ***
  • Posts: 58
Re: ExifTool PHP Fast Processing Script using StayOpen and Gearman
« Reply #30 on: May 22, 2014, 01:50:18 PM »
Thats just the defaults for the API and as it happens we store the JSON data directly in the DB instead of using PHP serialise/unserialize, we considered json to be more portable than PHP arrays, pros and conns for everything.
It does not cause any problem putting it in PHP mode in my script as if you use fetch() it does not try and decode it, passes it raw back to you to do as you please, if you use fetchDecoded() then it will require the output format to be json.
Why I did this I do not know, but works for us.
Im just altering our internal app so we move all exiftool writing over to use the API via Gearman instead of local, before we were only optimizing the reading.

klarakos

  • Newbie
  • *
  • Posts: 3
Re: ExifTool PHP Fast Processing Script using StayOpen and Gearman
« Reply #31 on: August 01, 2014, 05:52:49 AM »
Hmmm, i think its all got slow once i moved to using fgets using a buffered socket, before i was using streams but found it incompatible with different version of php.
Ive checked and the PID does not change of the underlying perl once it has been started so its related to the fgets.
Ile look into it and get it sorted hopefully.

TSM

  • Full Member
  • ***
  • Posts: 58
Re: ExifTool PHP Fast Processing Script using StayOpen and Gearman
« Reply #32 on: August 01, 2014, 12:51:54 PM »
Hmmm, i think its all got slow once i moved to using fgets using a buffered socket, before i was using streams but found it incompatible with different version of php.
Ive checked and the PID does not change of the underlying perl once it has been started so its related to the fgets.
Ile look into it and get it sorted hopefully.

??

mauricio

  • Newbie
  • *
  • Posts: 1
Re: ExifTool PHP Fast Processing Script using StayOpen and Gearman
« Reply #33 on: June 30, 2019, 06:46:52 PM »
I have written a simple php script to run exiftool, it works correctly but I am not sure if it is the best way to implement it, they could give me advice or give their point of view.
thank you in advance for your cooperation

Code: [Select]
<?php 
  $env 
null
  
$cwd "."
  
$descriptorspec = array ( 
  
=> array ( "pipe" "r" ),  
  
=> array ( "pipe" "w" ), 
  ); 
  
 
$command escapeshellcmd("exiftool -json imagenes/test3.jpg");
 
$process proc_open($command,$descriptorspec,$pipes,$cwd,$env); 

  if (
is_resource($process)) {
   
    
fwrite($pipes[0], "-stay_open\nFalse\n");
    
fclose($pipes[0]);

    echo 
stream_get_contents($pipes[1]);
    
fclose($pipes[1]);
    
    
proc_close($process);

}
?>