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

FileFactory can't create gif files #37742

Closed
AmirRezaM75 opened this issue Jun 19, 2021 · 1 comment
Closed

FileFactory can't create gif files #37742

AmirRezaM75 opened this issue Jun 19, 2021 · 1 comment

Comments

@AmirRezaM75
Copy link
Contributor

  • Laravel Version: 8.43.0
  • PHP Version: 7.4.20
  • Database Driver & Version: MySQL 8.0

Steps To Reproduce:

I needed to create image file with gif extension in my tests.

$this->post('dashboard/media', [
    'image' => UploadedFile::fake()->image('example.gif')
])->assertRedirect('dashboard/media');

I get image file using $request->file('image') and save it in storage disk.
It saves the file with correct extension but when I'm using mime_content_type, it returns image/png.

Description:

I scanned the code base and I noticed we can only create jpeg or png files with this class.

return new File($name, $this->generateImage(
$width, $height, Str::endsWith(Str::lower($name), ['.jpg', '.jpeg']) ? 'jpeg' : 'png'
));

@driesvints
Copy link
Member

Seems like a feature request. Seems like you already attempted a pr. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants