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

Cannot upload a photo if the size is more than #11

Closed
benoitjpnet opened this issue Jul 27, 2019 · 7 comments
Closed

Cannot upload a photo if the size is more than #11

benoitjpnet opened this issue Jul 27, 2019 · 7 comments

Comments

@benoitjpnet
Copy link

Screenshot_20190727_161639

If I upload a photo with a size superior to 1900kB it produce error.

Steps to reproduce:

  • Get a big picture

  • Compress to 1900kB jpegoptim -S1900

  • Upload

  • It works

  • Get a big picture

  • Keep it superior to 1900kB, i.e. 2000kB jpegoptim -S2000

  • Upload

  • It fails.

Logs:

[2019-07-27 14:15:59] production.ERROR: The "" file does not exist or is not readable. {"userId":1,"exception":"[object] (Symfony\\Component\\Mime\\Exception\\InvalidArgumentException(code: 0): The \"\" file does not exist or is not readable. at /home/pixelfed/vendor/symfony/mime/FileinfoMimeTypeGuesser.php:52)
[stacktrace]
#0 /home/pixelfed/vendor/symfony/mime/MimeTypes.php(136): Symfony\\Component\\Mime\\FileinfoMimeTypeGuesser->guessMimeType('')
pixelfed/pixelfed#1 /home/pixelfed/vendor/symfony/http-foundation/File/File.php(73): Symfony\\Component\\Mime\\MimeTypes->guessMimeType('')
pixelfed/pixelfed#2 /home/pixelfed/app/Http/Controllers/Api/BaseApiController.php(249): Symfony\\Component\\HttpFoundation\\File\\File->getMimeType()
pixelfed/pixelfed#3 [internal function]: App\\Http\\Controllers\\Api\\BaseApiController->uploadMedia(Object(Illuminate\\Http\\Request))
pixelfed/pixelfed#4 /home/pixelfed/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
[…]
[27/Jul/2019:14:15:59 +0000] "POST /api/v1/media HTTP/1.1" 500 44 "https://pix.benpro.fr/" "Mozilla/5.0 (X11; Linux x86_64; rv:69.0) Gecko/20100101 Firefox/69.0"

.env:

MAX_PHOTO_SIZE=15000 (is it in kB?)
@dansup
Copy link
Member

dansup commented Jul 28, 2019

@benpro That is correct, the default limit is 15MB. The issue is likely PHP ini configuration POST_MAX_SIZE which default is 2MB iirc. Check that and your webserver configuration, make sure its at or above the MAX_PHOTO_SIZE of pixelfed.

@dansup dansup closed this as completed Jul 28, 2019
@benoitjpnet
Copy link
Author

@dansup
post_max_size is at 8M.
But upload_max_filesize is at 2M, that was the cause!

I wonder why there was no error in my error.log for that. Do you override errors?

@Deuchnord
Copy link

If you use a reverse-proxy (Apache/Nginx) in front of the app run with Docker, you have to configure it to allow big bodies too. Otherwise the picture will be rejected.

@cpnfeeny
Copy link

If you use a reverse-proxy (Apache/Nginx) in front of the app run with Docker, you have to configure it to allow big bodies too. Otherwise the picture will be rejected.

This should probably be added to the instructions. Changing php.ini doesn't help if you don't also add

http {
    # […]
    client_max_body_size 100m;
    # […]
}

to nginx.conf.

@bankersbaddream
Copy link

If you use a reverse-proxy (Apache/Nginx) in front of the app run with Docker, you have to configure it to allow big bodies too. Otherwise the picture will be rejected.

This should probably be added to the instructions. Changing php.ini doesn't help if you don't also add

http {
    # […]
    client_max_body_size 100m;
    # […]
}

to nginx.conf.

Absolutely I got hung up on this. Some nice folks on IRC sorted me out and pointed me in the right direction. I was also made aware that I needed to configure the correct php.ini for FPM.

@trwnh trwnh transferred this issue from pixelfed/pixelfed Oct 9, 2019
@mikail97
Copy link

mikail97 commented Jul 3, 2021

The same thing is happening to me, where I find the file in which I can modify the size?
Thanks in advance! @benpro

@trwnh
Copy link
Member

trwnh commented May 13, 2022

The same thing is happening to me, where I find the file in which I can modify the size?

@mikail97 you want to edit php.ini which can usually be found in /etc/php or similar

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

7 participants