2013-10-05 66 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

明白了! :) 謝謝 –