Needs review
Project:
Data Matrix API
Version:
6.x-1.0
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
3 Jan 2011 at 02:38 UTC
Updated:
3 Jan 2011 at 02:43 UTC
Adjust the following function thus:
/**
* Executes a dmtxread or dmtxwrite command using exec()/popen().
*/
function datamatrix_exec($command, $mode = NULL, array $options = array()) {
if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') {
$command = '"' . $command . '"';
}
foreach ($options as $k => $v) {
$command .= ' --'. $k . ($v === TRUE ? '' : '='. escapeshellarg((string)$v));
}
$arguments = array_slice(func_get_args(), 3);
$command = trim($command .' '. implode(' ', array_map('escapeshellarg', $arguments)));
if (!$mode) {
exec($command, $output, $result);
return $result === 0 ? $output : FALSE;
}
return popen($command, $mode);
}
Comments
Comment #1
rconstantine commentedBTW, the paths admins enter would look something like this:
C:/Program Files/ImageMagick-6.6.6-Q8/dmtxwrite.exe
C:/Program Files/ImageMagick-6.6.6-Q8/dmtxread.exe
These cannot have quotes put around them or they won't validate.
Perhaps the documentation (and admin messages) could be updated to reflect this.