samedi 3 septembre 2016

Laravel, issue with embedding image in job queue

I have a strange issue with embedding image in job queue.
I am using WAMP for development. Folder structure for my project is C:\wamp\MyProject & the public directory is at C:\wamp\www\app

Mail::send('emails.mailtemplate_rule', ['body' => $data['body']], function ($message) use ($data) {
    $message->to($data['to']);
    $message->from($data['from'], $data['namefrom']);
    $message->subject($data['subject']);
});

<img src="" alt='MyProject' data-default="placeholder" data-max-width="300">

This is working fine when I run this but when I change the driver from 'sync' to 'database' and update the mail function as below:

Mail::queue('emails.mailtemplate_template', ['body' => $data['body']], function ($message) use ($data) {
    $message->to($data['to']);
    $message->from($data['from'], $data['namefrom']);
    $message->subject($data['subject']);
});

When I run the above, I can see the data entry in my jobs table. but when I execute the command: php artisan queue:work It throws as exception which is

[Error Exception]
fopen(assets/images/logo.png): failed to open stream: No such file or directory

If I remove the image it works as a charm. Now I am wondering that why it is not able to find the image while without using job queue it can find the image & embed it into the mail. It should work as desired.
Any help to this, will be appreciated.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire