When dynamically building archives if we use the MTSecurityCode tag then the image fails to validate. The reason is the following. If you open this file function.MTSecurityCode.php in the PHP and plugins folder, you will see the following code:
<?php
function smarty_function_MTSecurityCode($args, &$ctx) {
$config = $ctx->mt->db->fetch_plugin_config("SCode");
$maxtmp = intval($config['maxtmp']);
$code = mt_rand(1,$maxtmp);
return $code;
}
?>
Calling this function twice will generate two separate and independent codes. According to the documentation if you use the code supplied in step 5 of the usage section then notice how the tag: MTSecurityCode is called twice in the dynamic mode this causes the image to be generated twice.
The solution to the problem was following I modified the function.MTCodeInsert.php to fit my needs and used that instead of MTSecurityCode.