Tuesday, March 7, 2017

Larvel + Image Intervention : Force download of file that is not saved

I want to simply upload files , resize them and then force a download for every uploaded file. I do not want to save the files.

Resizing etc. works fine, however i cannot manage to force the download of the new file.

$content = $image->stream('jpg');

return response()->download($content, $name);

The shown snippet results in

is_file() expects parameter 1 to be a valid path, string given

Most probably because $content is not a path but the actual data.

Is there a way to enforce the download without saving it first?



via Frank Provost

Advertisement