Hi all

Ive been investigating using the qrencode c module. From command line all works perfectly so I know the qrencode package is working. However ran into problems with the module. Using the Google_chart_api all works well as well !

To use the Libqrencode option I had to make the following changes.

module_invoke doesnt seem to trigger when using Libqrencode? I couldnt sort that easily, so worked around using a switch/case

function qr_codes_generate($data, $width, $height, $margin = 0) {
// Create a unique file name using all image attributes.
$imagename = md5($data . $width . $height . $margin) . '.png';
$dir = 'public://' . variable_get('qr_codes_cache_dir', 'qr_codes') . '/';
$file = $dir . $imagename;
// Cache locally.
if (!file_exists($file)) {
if (!file_prepare_directory($dir, FILE_CREATE_DIRECTORY)) {
drupal_set_message(t('Failed to create the qr_codes directory.'));
return '';
}

// Find out which module is handling the image generation.
list($module,) = explode(':', variable_get('qr_codes_engine', 'qr_codes_google_chart:google_chart'), 2);
// Invoke the right module for file generation.

// Doesnt seem to trigger when using qrencode??? so added the switch/case after

module_invoke($module, 'qr_codes_generate', $file, $data, $width, $height, $margin);

switch ($module){
case "qr_codes_qrencode":
qr_codes_qrencode_qr_codes('generate',$file,$data,$width,$height,$margin);
break ;
}
}

return $file;
}

second mod was to engines/qr_codes_qrencode.module

function qr_codes_qrencode_qr_codes($op, $a2 = NULL, $data = NULL, $width = NULL, $height = NULL, $margin = NULL) {
.......

case 'generate':

$options = array(
'output' => drupal_realpath($a2), //had to convert from a stream to a realpath, as qrencode didnt know how to handle
);
if (!is_null($margin)) {
$options['margin'] = $margin;
}

$command = QR_CODES_QRENCODE_PATH;

foreach ($options as $k => $v) {
$command .= ' --'. $k . ($v === TRUE ? '' : '='. escapeshellarg((string)$v)) . " " . $data; //added the data to the call
}

if ($handle = popen($command, 'w')) {
fwrite($handle, $data);
return pclose($handle) === 0 ? $options['output'] : FALSE;
}

note have explained my changes in the comments, hope this helps a little thanks.