jeudi 28 janvier 2016

laravel 5.1 queues undefined function in handle() but working in constructor

I use Laravel 5.1 queues to process large images. I've a very strange behavior since when I call a function "imagettfbbox" in the constructor it works. But obviously I need to make it work in the "handle" but there I got an error.

public function __construct()
{
    //TEST
    $font_path = public_path('/fonts/roboto/Roboto-Thin.ttf');

    imagecreate(10,10); //works!
    imagettfbbox(10, 0, $font_path, 'test'); //works!
}

public function handle() //GenerateImage $generator, Image $img
{
    //TEST
    print 'OK'; //gets printed
    $font_path = public_path('/fonts/roboto/Roboto-Thin.ttf');

    imagecreate(10,10); //works!
    imagettfbbox(10, 0, $font_path, 'test'); //CRASHES!
}

I get the 'OK' printed and then the error "Call to undefined function App\Jobs\imagettfbbox()". It is a very strange behavior since some image functions work other not. I've GD installed and everywhere outside handle the code works. Any clue what I'm missing here?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire