/**
* Renders the CAPTCHA image.
* @param string $code the verification code
* @return string image contents
*/
protected function renderImage($code)
{
// alphabets ?
if (!$this->useMbChars) {
return parent::renderImage($code);
}
// font defaults to seto-mini.ttf
if ($this->mbFontFile === null) {
$this->mbFontFile = __DIR__ . DIRECTORY_SEPARATOR . 'seto-mini.ttf';
}
$encoding = 'UTF-8';
if (Captcha::checkRequirements() === 'gd') {
// check if conversion to Shift_JIS is needed
$gd_info = gd_info();
if ($gd_info['JIS-mapped Japanese Font Support']) {
$code = mb_convert_encoding($code, 'SJIS', 'UTF-8');
$encoding = 'SJIS';
}
return $this->mbRenderImageByGD($code, $encoding);
} else {
return $this->mbRenderImageByImagick($code, $encoding);
}
}