Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/ImageWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use Illuminate\Http\Response;
use Knp\Snappy\Image as SnappyImage;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\Storage;
use Symfony\Component\HttpFoundation\StreamedResponse;

/**
Expand Down Expand Up @@ -137,10 +138,11 @@ public function save($filename, $overwrite = false)
*/
public function download($filename = 'image.jpg')
{
return new Response($this->output(), 200, array(
'Content-Type' => 'image/jpeg',
'Content-Disposition' => 'attachment; filename="'.$filename.'"'
));
Storage::put($filename, $this->output());

return response()
->download(Storage::path('/').$filename)
->deleteFileAfterSend();
}

/**
Expand Down
10 changes: 6 additions & 4 deletions src/PdfWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
use Illuminate\Http\Response;
use Knp\Snappy\Pdf as SnappyPDF;
use Illuminate\Support\Facades\View;
use Illuminate\Support\Facades\Storage;
use Illuminate\Contracts\Support\Renderable;
use Symfony\Component\HttpFoundation\StreamedResponse;

Expand Down Expand Up @@ -213,10 +214,11 @@ public function save($filename, $overwrite = false)
*/
public function download($filename = 'document.pdf')
{
return new Response($this->output(), 200, array(
'Content-Type' => 'application/pdf',
'Content-Disposition' => 'attachment; filename="'.$filename.'"'
));
Storage::put($filename, $this->output());

return response()
->download(Storage::path('/').$filename)
->deleteFileAfterSend();
}

/**
Expand Down