Laravel File Downloaded from storage folder gets corrupted

I believe that the Laravel framework might be introducing whitespace which might be ruining the header() function.

Use ob_end_clean() before your first header() call to remove any extra whitespace.

ob_end_clean();
$headers = array(
‘Content-Type: image/png’,
);
return response()->download(storage_path() . ‘/’.$filename, ‘final.png’, $headers);

https://exceptionshub.com/laravel-file-downloaded-from-storage-folder-gets-corrupted.html

Laravel – Crop and upload an image with jQuery Croppie plugin using Ajax

https://learninglaravel.net/laravel-crop-and-upload-an-image-with-jquery-croppie-plugin-using-ajax

Laravel – Crop and upload an image with jQuery Croppie plugin using Ajax http://www.phpzone.in/laravel-crop-and-upload-an-image-with-jquery-croppie-plugin-using-ajax/