2013-10-05 68 views
1

因此,我不想在CI上使用secureimage coz'我不想使用默认的CAPTCHA助手,因为它没有音频选项,但是在使用secureimage时显示音频时出现问题。CodeIgniter中的SecureImage

我复制了从站点下载到CI库的整个secureimage文件夹。

显示图像很好,也检查输入的代码。但我的问题是显示音频文件。我不知道该怎么做。

这里是我所显示的图像,以及检查(已使用的secureimage库):

function captcha_image(){ 
    $img = new Securimage(); 
    return $img->show(); 
} 

public function captcha_check(){ 
    $img = new Securimage(); 
    $input = $this->input->post('imagecode'); 
    $result = $img->check($input); 


    if($result) 
     $message = "success"; 
    else 
     $message = "try again"; 
} 

我的观点:

<img src="<?php echo site_url('form/captcha_image') ?>" alt='captcha' /> 

回答

1

如果您正在使用这个库 https://github.com/subdesign/CI-HTI-Securimage

所以获取音频文件的方法是

$ img-> outputAudioFile();

但你必须配置(设置)音频路径目录,并确保其可擦写

$settings['audio_path'] = '....';// If you didn't configure this it will secureimage library path and follow by dir /audio/ 
$settings['audio_noise_path'] = '...';//save as above audio path 
$settings['audio_use_noise'] = true; // true or false; 
$settings['degrade_audio'] = true; // true or false; 

// Then init the secureimage with the options 
$img = new Securimage($settings); 
$img->show(); // this will show the image src 
$img->outputAudioFile(); // this will output the audio file to the browser 
+0

我应该调用$ IMG在我的看法? –

+0

@KairiSan你可以在控制器或视图中调用它,如果你从控制器传递它。 – Meabed

+0

明白了! :) 谢谢 –