How setting a particular jpg as profile picture failed even though its file size was apparently small enough?

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 26.0.0
Operating system and version (eg, Ubuntu 20.04): Ubuntu 22.04.1
Apache or nginx version (eg, Apache 2.4.25): 2.4.52
PHP version (eg, 7.4): 8.1.2

The issue you are facing:

As described in the title, I found out that

  • setting a particular jpg as profile picture ended up with ‘Error saving profile picture’ even though its file size was 169KB
  • the error notification would come out if axios.post fails in AvatarSection.vue
  • in php.ini was upload_max_filesize=2M directive, which was by default.

For the jpg I tried, please refer to Issue #37501 · nextcloud/server (github.com).

Being new to Nextcloud codebase, I would rather like to understand the underlying mechanisms than seek to the solution.

Also it was pretty confusing to me for the fixed text of “max. 20 MB” to be on the screen.

Now I have two questions:

  1. How is it possible for such a thing to occur? How did its blob exceed the upload_max_filesize of 2M?
  2. What is the value of 20 MB on the screen based on?

Thanks,

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Go to Edit Profile
  2. Select a particular jpg to upload
  3. Click “Set as profile picture”

The output of your Nextcloud log in Admin > Logging:

Warning	core	The uploaded file exceeds the upload_max_filesize directive in php.ini

FYI some more random findings:

  • From a few more attempts I concluded that it could be the image size–not file size–that matters whether setting a jpg image as profile picture succeeds or fails.
  • To be specific, one jpg that was resized to 1187x1187 succeeded to set, but another 1188x1188 failed in spite of generated in the same way from the identical image.
  • The boundary number of pixels whether a set succeeds or fails vary by based jpg images.
  • For png in similar size I have no problem so far.
  • All my attempts were done on Nextcloud 26 newly deployed into Ubuntu 22.04.1 VM from latest.zip, following Example installation on Ubuntu 22.04 LTS and Apache Web server configuration.
  • It ran with the least out-of-the-box configuration based on the documentation.
  • I consider it is in virtually default state as I added nothing special at all.