Some code simplifications.

This commit is contained in:
James Cole
2016-04-28 16:30:21 +02:00
parent e28e66e8f1
commit ea014a6504
5 changed files with 30 additions and 25 deletions

View File

@@ -128,12 +128,13 @@ class AttachmentController extends Controller
*/
public function preview(Attachment $attachment)
{
if ($attachment->mime == 'application/pdf') {
$file = public_path('images/page_white_acrobat.png');
} else {
$file = public_path('images/page_green.png');
}
$image = 'images/page_green.png';
if ($attachment->mime == 'application/pdf') {
$image = 'images/page_white_acrobat.png';
}
$file = public_path($image);
$response = Response::make(File::get($file));
$response->header('Content-Type', 'image/png');