Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Content-Type Response Header #183

Closed
devheniik opened this issue Nov 10, 2022 · 2 comments
Closed

Content-Type Response Header #183

devheniik opened this issue Nov 10, 2022 · 2 comments
Assignees
Labels

Comments

@devheniik
Copy link

devheniik commented Nov 10, 2022

Description:

I keep my images on aws s3, when user try to get image, he use api route
Route::get('files/{id}', [FindFileByIdController::class, 'findFileById'])
so next step I check access to file, if all good give a image,
Task => return Image::make(Storage::disk('s3')->get($file->path));
Controller =>

$file = app(FindFileByIdAction::class)->run($request);

        return response(
            $file->response(), 200,
            [
                'Content-Type' => $file->type,
                'Content-Disposition' => "attachment; filename=" . $file->name .""
            ]);

But Content Type not changed, stay json and image broke, but i set a truth content type, can i resolve this problem?

Maybe this is not quite a bug, but I would really appreciate your help)

Fotos

image

Versions:

  • Apiato Version: 11
  • PHP Version: 8
@Elshaden
Copy link

Elshaden commented Dec 3, 2022

Hi
If you are sending the image to a frontend,
why not just generate S3 TemporaryURL and send it to the frontend , where the can download direct from S3.

https://laravel.com/docs/9.x/filesystem#temporary-urls

@devheniik
Copy link
Author

Thanks for your answer, I knew about it and did so,
But I wanted to understand how to change response header, maybe later I need to stream data or download file, etc ..
As I understand it is not possible(

@Mohammad-Alavi Mohammad-Alavi reopened this Jul 7, 2023
@Mohammad-Alavi Mohammad-Alavi self-assigned this Jul 12, 2023
@Mohammad-Alavi Mohammad-Alavi transferred this issue from apiato/apiato Jul 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants