nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
26.34k stars 3.97k forks source link

No profile image upload possible #8984

Closed jgrete closed 5 years ago

jgrete commented 6 years ago

Steps to reproduce

  1. Upload a profile image (jpg, 100-500kb, or png)

Expected behaviour

Upload should be sucessfull

Actual behaviour

Unsucessfull! Message apears:"Invalid image provided"

Server configuration detail

Operating system: Linux 4.4.114-42-default #1 SMP Tue Feb 6 10:58:10 UTC 2018 (b6ee9ae) x86_64

Webserver: Apache (apache2handler)

Database: mysql 10.2.13

PHP version: 7.0.7 Modules loaded: Core, date, libxml, pcre, filter, hash, Reflection, SPL, session, SimpleXML, standard, xml, mysqlnd, apache2handler, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, gmp, iconv, imap, intl, json, exif, mcrypt, mysqli, openssl, pcntl, PDO, pdo_mysql, pdo_sqlite, posix, shmop, sockets, sqlite3, tidy, tokenizer, xmlreader, xmlwriter, xsl, zip, zlib, Zend OPcache

Nextcloud version: 13.0.1 - 13.0.1.1

Updated from an older Nextcloud/ownCloud or fresh install: Fresh Where did you install Nextcloud from: unknown Official download site

Signing status Array
List of activated apps ``` Enabled: - activity: 2.6.1 - admin_audit: 1.3.0 - announcementcenter: 3.2.1 - apporder: 0.4.1 - bookmarks: 0.11.0 - bruteforcesettings: 1.0.3 - calendar: 1.6.1 - checksum: 0.3.5 - circles: 0.13.6 - cms_pico: 0.9.7 - comments: 1.3.0 - contacts: 2.1.2 - dav: 1.4.6 - drawio: 0.8.9 - end_to_end_encryption: 1.0.5 - external: 3.0.2 - federatedfilesharing: 1.3.1 - federation: 1.3.0 - files: 1.8.0 - files_accesscontrol: 1.3.0 - files_automatedtagging: 1.3.0 - files_downloadactivity: 1.2.0 - files_external: 1.4.1 - files_markdown: 2.0.4 - files_pdfviewer: 1.2.1 - files_reader: 1.2.3 - files_retention: 1.2.0 - files_sharing: 1.5.0 - files_texteditor: 2.5.1 - files_trashbin: 1.3.0 - files_versions: 1.6.0 - files_videoplayer: 1.2.0 - firstrunwizard: 2.2.1 - gallery: 18.0.0 - gpxedit: 0.0.8 - gpxmotion: 0.0.6 - gpxpod: 2.2.2 - groupfolders: 1.2.0 - impersonate: 1.0.3 - issuetemplate: 0.3.0 - logreader: 2.0.0 - lookup_server_connector: 1.1.0 - mail: 0.7.10 - metadata: 0.6.0 - nextcloud_announcements: 1.2.0 - notes: 2.3.2 - notifications: 2.1.2 - oauth2: 1.1.0 - ownbackup: 17.5.0 - ownpad: 0.6.6 - password_policy: 1.3.0 - polls: 0.8.1 - previewgenerator: 1.0.9 - provisioning_api: 1.3.0 - quota_warning: 1.2.0 - radio: 0.6.1 - ransomware_protection: 1.1.0 - registration: 0.4.0 - serverinfo: 1.3.0 - sharebymail: 1.3.0 - socialsharing_diaspora: 1.0.2 - socialsharing_email: 1.0.3 - socialsharing_facebook: 1.0.2 - socialsharing_googleplus: 1.0.2 - socialsharing_twitter: 1.0.2 - spreed: 3.1.0 - survey_client: 1.1.0 - systemtags: 1.3.0 - tasks: 0.9.6 - theming: 1.4.1 - twofactor_backupcodes: 1.2.3 - updatenotification: 1.3.0 - user_usage_report: 1.0.1 - workflowengine: 1.3.0 Disabled: - encryption - user_external - user_ldap ```
Configuration (config/config.php) ``` { "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "grete.dedyn.io", "cloud-server.fritz.box" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "overwrite.cli.url": "https:\/\/grete.dedyn.io\/nextcloud", "dbtype": "mysql", "version": "13.0.1.1", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "oc_", "mysql.utf8mb4": true, "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "mail_smtpmode": "smtp", "mail_smtpsecure": "tls", "mail_from_address": "***REMOVED SENSITIVE VALUE***", "mail_domain": "***REMOVED SENSITIVE VALUE***", "mail_smtpauthtype": "PLAIN", "mail_smtpauth": 1, "mail_smtphost": "***REMOVED SENSITIVE VALUE***", "mail_smtpport": "587", "mail_smtpname": "***REMOVED SENSITIVE VALUE***", "mail_smtppassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "maintenance": false, "theme": "thema1", "memcache.locking": "OC\\Memcache\\Redis", "redis": { "host": "***REMOVED SENSITIVE VALUE***", "port": 6379 } } ```

Are you using external storage, if yes which one: local/smb/sftp/... smb Are you using encryption: no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/... no

LDAP configuration (delete this part if not used)

Client configuration

Browser: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36

Operating system: Windows/Linux

Logs

Browser log ``` Insert your webserver log here ```
Nextcloud log ``` not useful information inside. Will provide if necessary ```
Browser log Insert your browser log here, this could for example include: all browsers
jgrete commented 6 years ago

Am I really the only one?? I tried to upload the same picture into the contacts app - no problem. But this picture uploaded to the profile of my nextcloud account - no way.

AlexMaj commented 6 years ago

exactly same issue with my nextcloud install

jgrete commented 6 years ago

To make things worse, after my unsuccessful trials the image is gone! On the right upper corner I saw a capitalized character of my name. Now I see nothing - only the menus background...

Nils160988 commented 6 years ago

I can not confirm the issue. Nextcloud 13.0.1 here as well.

jgrete commented 6 years ago

@Nils160988 Are there any obvious differences between your setup and mine (see above) ?

jgrete commented 6 years ago

I was playing with a complete different thing (authentication by application token) and noticed that my default profile picture was back again ("J"). I decided to do another test and uploaded the profile picture again. This time I uploaded it into the cloud first and was using the directory symbol (located just below the profile picture on the personal settings page). Et voilà ... the picture editor appears and I was able to cut and save. This is no solution of course. But hopefully helps until the responsible programmer has time to fix it

Nils160988 commented 6 years ago

My setup is: Linux 4.4.0, php 7.0.28, mariadb 10.0.34 but I have no idea whether is has to do with some of these differences...

feutl commented 6 years ago

had the same issue like @jgrete did a fresh install of nextcloud following bayton guide. the only difference I have to this guide is the data directory was moved outside www and is now hosted via NFS,

I figured out that the my permissions where wrong, fixed them and everything was fine.

MorrisJobke commented 6 years ago

I was playing with a complete different thing (authentication by application token) and noticed that my default profile picture was back again ("J"). I decided to do another test and uploaded the profile picture again. This time I uploaded it into the cloud first and was using the directory symbol (located just below the profile picture on the personal settings page). Et voilà ... the picture editor appears and I was able to cut and save. This is no solution of course. But hopefully helps until the responsible programmer has time to fix it

Do you have by any chance the picture that fails? Because it seems to be related to what image you are using.

jgrete commented 6 years ago

This picture cannot be uploaded via upload button, but without any problems via file dialogbox: pacoprofil_jgrete

skjnldsv commented 5 years ago

Cannot reproduce Capture d’écran_2019-04-30_10-36-10

As there is no feedback since a while I will close this ticket. If this is still happening please feel free to reopen.

werdahias commented 3 years ago

Having this issue with a fresh install of 19.0.4. I can select a picture, but it keeps on loading but to no avial. Any ideas here? LOG:

`[PHP] Error: Error: file_put_contents(/mnt/sda1/nextcloud/nc_data/appdata_ocu3klcbsqe5/avatar/user/avatar.jpg): failed to open stream: No such file or directory at /var/www/nextcloud/lib/private/Files/Storage/Local.php#276 at <<closure>>

 0. <<closure>>
    OC\Log\ErrorHandler::onError(2, "file_put_conten ... y", "/var/www/nextcl ... p", 276, {path: "appdata_ ... l})
 1. /var/www/nextcloud/lib/private/Files/Storage/Local.php line 276
    file_put_contents("/mnt/sda1/nextc ... g", null)
 2. /var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php line 257
    OC\Files\Storage\Local->file_put_contents("appdata_ocu3klc ... g", null)
 3. /var/www/nextcloud/lib/private/Files/View.php line 1159
    OC\Files\Storage\Wrapper\Wrapper->file_put_contents("appdata_ocu3klc ... g", null)
 4. /var/www/nextcloud/lib/private/Files/View.php line 696
    OC\Files\View->basicOperation("file_put_contents", "/appdata_ocu3kl ... g", ["create","write"], null)
 5. /var/www/nextcloud/lib/private/Files/Node/Folder.php line 187
    OC\Files\View->file_put_contents("/appdata_ocu3kl ... g", null)
 6. /var/www/nextcloud/lib/private/Files/SimpleFS/NewSimpleFile.php line 133
    OC\Files\Node\Folder->newFile("avatar.jpg", null)
 7. /var/www/nextcloud/lib/private/Avatar/UserAvatar.php line 109
    OC\Files\SimpleFS\NewSimpleFile->putContent(null)
 8. /var/www/nextcloud/core/Controller/AvatarController.php line 334
    OC\Avatar\UserAvatar->set(null)
 9. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 170
    OC\Core\Controller\AvatarController->postCroppedAvatar({x: "302.08",y:  ... "})
10. /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php line 100
    OC\AppFramework\Http\Dispatcher->executeController(OC\Core\Controller\AvatarController {}, "postCroppedAvatar")
11. /var/www/nextcloud/lib/private/AppFramework/App.php line 137
    OC\AppFramework\Http\Dispatcher->dispatch(OC\Core\Controller\AvatarController {}, "postCroppedAvatar")
12. /var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php line 47
    OC\AppFramework\App::main("OC\\Core\\Controller\\AvatarController", "postCroppedAvatar", OC\AppFramework\ ... {}, {_route: "core.avatar.postCroppedAvatar"})
13. <<closure>>
    OC\AppFramework\Routing\RouteActionHandler->__invoke({_route: "core.avatar.postCroppedAvatar"})
14. /var/www/nextcloud/lib/private/Route/Router.php line 297
    call_user_func(OC\AppFramework\ ... {}, {_route: "core.avatar.postCroppedAvatar"})
15. /var/www/nextcloud/lib/base.php line 1011
    OC\Route\Router->match("/avatar/cropped")
16. /var/www/nextcloud/index.php line 37
    OC::handleRequest()

POST /index.php/avatar/cropped
from IP by user at 2020-10-15T18:20:30+00:00`
fredericrous commented 3 years ago

I don't see error logs but I have the same issue. The image doesn't get uploaded, instead I get an empty image. here is a picture of the user list with a picture of me and a picture of my girlfriend: image

werdahias commented 3 years ago

I fixed this by manually creating the /Avatar directory and then it magically worked.

pinpox commented 3 years ago

I have this issue as well. Creating the /Avatar directory for every user is not a real solution. Any help?

gillesF78 commented 2 years ago

Same issue here.

I cannot customize my profile photo, neither with the "upload" button, nor with the "Choose file" button.

My running nextcloud version is 22.2.2.0

My nc-error.log file says : AH01071: Got error 'PHP message: PHP Notice: Unknown: file created in the system's temporary directory in Unknown on line 0'

arielnmz commented 2 years ago

This happens in a docker container with nextcloud version 21.0.22

Request URL: http://cloud.crowbarworks.com/avatar/cropped
Request Method: POST
Status Code: 400 Bad request
Remote Address: 192.168.0.13:80
Referrer Policy: no-referrer
{"data":{"message":"An error occurred. Please contact your admin."}}
arielnmz commented 2 years ago

Just upgraded to version 22.2.5 and now it fails with a 500 error:

Request URL: http://cloud.crowbarworks.com/avatar/cropped
Request Method: POST
Status Code: 500 Internal Server Error
Remote Address: 192.168.0.13:80
Referrer Policy: no-referrer

Error:

{
  "Exception": "Exception",
  "Message": "imagecreatetruecolor(): Argument #1 ($width) must be greater than 0",
  "Code": 0,
  "Trace": [
    {
      "file": "/var/www/html/lib/private/AppFramework/App.php",
      "line": 156,
      "function": "dispatch",
      "class": "OC\\AppFramework\\Http\\Dispatcher",
      "type": "->",
      "args": [
        {
          "__class__": "OC\\Core\\Controller\\AvatarController"
        },
        "postCroppedAvatar"
      ]
    },
    {
      "file": "/var/www/html/lib/private/Route/Router.php",
      "line": 302,
      "function": "main",
      "class": "OC\\AppFramework\\App",
      "type": "::",
      "args": [
        "OC\\Core\\Controller\\AvatarController",
        "postCroppedAvatar",
        {
          "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
        },
        {
          "_route": "core.avatar.postCroppedAvatar"
        }
      ]
    },
    {
      "file": "/var/www/html/lib/base.php",
      "line": 1006,
      "function": "match",
      "class": "OC\\Route\\Router",
      "type": "->",
      "args": [
        "/avatar/cropped"
      ]
    },
    {
      "file": "/var/www/html/index.php",
      "line": 36,
      "function": "handleRequest",
      "class": "OC",
      "type": "::",
      "args": []
    }
  ],
  "File": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
  "Line": 158,
  "Previous": {
    "Exception": "ValueError",
    "Message": "imagecreatetruecolor(): Argument #1 ($width) must be greater than 0",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/lib/private/legacy/OC_Image.php",
        "line": 1175,
        "function": "imagecreatetruecolor",
        "args": [
          0,
          0
        ]
      },
      {
        "file": "/var/www/html/lib/private/legacy/OC_Image.php",
        "line": 1155,
        "function": "cropNew",
        "class": "OC_Image",
        "type": "->",
        "args": [
          0,
          0,
          0,
          0
        ]
      },
      {
        "file": "/var/www/html/core/Controller/AvatarController.php",
        "line": 323,
        "function": "crop",
        "class": "OC_Image",
        "type": "->",
        "args": [
          0,
          0,
          0,
          0
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 217,
        "function": "postCroppedAvatar",
        "class": "OC\\Core\\Controller\\AvatarController",
        "type": "->",
        "args": [
          {
            "x": "0",
            "y": "0",
            "w": "0",
            "h": "0"
          }
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 126,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\Core\\Controller\\AvatarController"
          },
          "postCroppedAvatar"
        ]
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/App.php",
        "line": 156,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\Core\\Controller\\AvatarController"
          },
          "postCroppedAvatar"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Route/Router.php",
        "line": 302,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OC\\Core\\Controller\\AvatarController",
          "postCroppedAvatar",
          {
            "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          {
            "_route": "core.avatar.postCroppedAvatar"
          }
        ]
      },
      {
        "file": "/var/www/html/lib/base.php",
        "line": 1006,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/avatar/cropped"
        ]
      },
      {
        "file": "/var/www/html/index.php",
        "line": 36,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/var/www/html/lib/private/legacy/OC_Image.php",
    "Line": 1175
  },
  "CustomMessage": "--"
}

There's also a previous error when you select an image that reads:

nextcloud_1  | NOTICE: PHP message: [owncloud][core][0] OC_Image->fixOrientation() Image is not a JPEG.
nextcloud_1  | NOTICE: PHP message: [owncloud][core][0] OC_Image->fixOrientation() Orientation: -1

I'm sure this is a JPEG, could the image utils/lib be broken?

werdahias commented 2 years ago

I fixed this by manually creating the /Avatar directory and then it magically worked.

Did you try that workaround?

arielnmz commented 2 years ago

Yes, it doesn't work for me

arielnmz commented 2 years ago

The problem is the Jcrop jquery plugin. It seems to be bugged and thinks images are 0x0 pixels. I tweaked the JS on the fly and injected the actual image dimensions before POSTing it and it works:

image