Closed Metrakit closed 10 years ago
Hi, @Metrakit.
Can you tell me a bit more about which Laravel version are you using?
Do you have a proper route set for the audio that accepts something like /audio/mp3
and /audio/ogg
? I see you're forcing mp3
on your code, but you really shouldn't as that will make visualCaptcha's accessibility not work in some browsers.
A route as something like:
Route::get( 'audio/{type?}', array('uses' => 'CaptchaController@audio') );
and in your audio
method, change it to:
public function audio( $type = 'mp3' ) {
// ...
return $captcha->streamAudio($response, $type);
If that still doesn't work, please share a bit more of your code so we can properly test it and play around with it.
Hi,
Thanks for your help.
The version of Laravel than I use it's the 4.2
I have declared my route like that:
Route::group(array('prefix' => 'captcha'), function()
{
Route::get('/start/{params}', array('as' => 'captcha/start', 'uses'=>'CaptchaController@start'));
Route::get('/audio', array('as' => 'captcha/audio', 'uses'=>'CaptchaController@audio'));
});
I should precise the params in my route ? But the problem is not here, it's about the "$response". How i can declare it ?
I got this error before: "The Response content must be a string or object implementing __toString()"
The route for audio needs the /{type?}
part because I don't think it's called at the moment if the URL is /audio/mp3
, and your route only allows /audio
.
The first parameter is an array that will get the headers set. If there's nothing like that for Laravel (would have to catch up on documentation, haven't used it in a while), try sending an empty array, but that might have mimetype issues.
Ok thanks, I will try it
@Metrakit any update?
Hi, Yeah I have finally successfully integrated VisualCaptcha with my Laravel app. It was only a stupid error by my fault about the Response class in Laravel. I shouldnt return directly that in a controller : "return $captcha->generate();". So now It work. But I have added some modifications to your library for I can use with Laravel. So I will can share with everyone the specific library than I have adapted for Laravel with a fork of your repository. For Laravel we have to use some basic functions of this framework to make it compliant and for have the best practices.
Thanks for this amazing library ! I'm bored of the Google's captcha and I wouldnt have to create by myself my own captcha's script.
Hi, Here is a Laravel version of your library : https://github.com/Metrakit/VisualCaptcha-Laravel
Cordially,
Metrakit.
Thanks, I added it to https://github.com/emotionLoop/visualCaptcha
Im trying to use your library with my Laravel apps. I have tried to adapt this exemple with my code. But I dont know how to adapt this following callback to my controller :
Here is my controller :
The start function works but not the audio function... I dont know how to add the first parameter to "$captcha->streamAudio($firstParam, $extension)".