### ⚠️ This issue respects the following points: ⚠️
- [X] This is a **bug**, no…t a question or a configuration/webserver/proxy issue.
- [X] This issue is **not** already reported on Github _(I've searched it)_.
- [X] Nextcloud Server **is** up to date. See [Maintenance and Release Schedule](https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule) for supported versions.
- [X] Nextcloud Server **is** running on 64bit capable CPU, PHP and OS.
- [X] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/).
### Bug description
When there is a folder which is backed by external storage(Backblaze B2 over S3 interface in my case) the thumbnails for uploaded files won't generate in the web-interface. Clicking the image files also doesn't show them but instead the message "Error while loading <filename>"/"Fehler beim laden von <filename>".
This problem can be fixed by visiting the folders with the android app.
### Steps to reproduce
1. add an external storage
2. upload files to it
3. open the folder in the web-interface and notice no thumbnails
4. open the folder in the android app and notice the thumbnails being generated and working
5. open the folder in the web-interface again and notice the thumbnails are now present
### Expected behavior
the thumbnails and image display should work regardless of where the files reside.
### Installation method
Community Web installer on a VPS or web space
### Operating system
Other
### PHP engine version
PHP 8.1
### Web server
Nginx
### Database engine version
PostgreSQL
### Is this bug present after an update or on a fresh install?
Updated to a major version (ex. 22.2.3 to 23.0.1)
### Are you using the Nextcloud Server Encryption module?
Encryption is Enabled
### What user-backends are you using?
- [X] Default user-backend _(database)_
- [ ] LDAP/ Active Directory
- [ ] SSO - SAML
- [ ] Other
### Configuration report
```shell
{ "system": { "instanceid": "***REMOVED SENSITIVE VALUE***", "passwordsalt": "***REMOVED SENSITIVE VALUE***", "secret": "***REMOVED SENSITIVE VALUE***", "trusted_domains": [ "cloud.rfreyt.ag" ], "datadirectory": "***REMOVED SENSITIVE VALUE***", "dbtype": "pgsql", "version": "25.0.4.1", "overwrite.cli.url": "https:\/\/cloud.rfreyt.ag", "dbname": "***REMOVED SENSITIVE VALUE***", "dbhost": "***REMOVED SENSITIVE VALUE***", "dbport": "", "dbtableprefix": "oc_", "dbuser": "***REMOVED SENSITIVE VALUE***", "dbpassword": "***REMOVED SENSITIVE VALUE***", "installed": true, "mail_from_address": "***REMOVED SENSITIVE VALUE***", "mail_smtpmode": "smtp", "mail_sendmailmode": "smtp", "mail_domain": "***REMOVED SENSITIVE VALUE***", "mail_smtphost": "***REMOVED SENSITIVE VALUE***", "mail_smtpport": "25", "memcache.local": "\\OC\\Memcache\\APCu", "mail_smtpsecure": "tls", "maintenance": false, "theme": "", "loglevel": 0, "logfile": "\/var\/log\/nextcloud\/nextcloud.log", "default_phone_region": "DE", "apps_paths": [ { "path": "\/usr\/share\/webapps\/nextcloud\/apps", "url": "\/apps", "writable": false }, { "path": "\/var\/lib\/nextcloud\/apps", "url": "\/wapps", "writable": true } ] } }
```
### List of activated Apps
```shell
Enabled: - activity: 2.17.0 - bruteforcesettings: 2.5.0 - calendar: 4.2.4 - camerarawpreviews: 0.8.1 - checksum: 1.2.0 - circles: 25.0.0 - cloud_federation_api: 1.8.0 - comments: 1.15.0 - contacts: 5.1.0 - contactsinteraction: 1.6.0 - dashboard: 7.5.0 - dav: 1.24.0 - encryption: 2.13.0 - federatedfilesharing: 1.15.0 - federation: 1.15.0 - files: 1.20.1 - files_accesscontrol: 1.15.1 - files_automatedtagging: 1.15.2 - files_downloadactivity: 1.15.0 - files_external: 1.17.0 - files_pdfviewer: 2.6.0 - files_rightclick: 1.4.0 - files_sharing: 1.17.0 - files_trashbin: 1.15.0 - files_versions: 1.18.0 - firstrunwizard: 2.14.0 - logreader: 2.10.0 - lookup_server_connector: 1.13.0 - metadata: 0.17.0 - nextcloud_announcements: 1.14.0 - notifications: 2.13.1 - oauth2: 1.13.0 - password_policy: 1.15.0 - photos: 2.0.1 - privacy: 1.9.0 - provisioning_api: 1.15.0 - recommendations: 1.4.0 - related_resources: 1.0.4 - serverinfo: 1.15.0 - settings: 1.7.0 - sharebymail: 1.15.0 - spreed: 15.0.4 - support: 1.8.0 - survey_client: 1.13.0 - systemtags: 1.15.0 - tasks: 0.14.5 - text: 3.6.0 - theming: 2.0.1 - twofactor_backupcodes: 1.14.0 - twofactor_totp: 7.0.0 - twofactor_webauthn: 1.1.1 - updatenotification: 1.15.0 - user_status: 1.5.0 - viewer: 1.9.0 - weather_status: 1.5.0 - workflowengine: 2.7.0 Disabled: - admin_audit - audioplayer: 3.3.1 - epubreader: 1.4.7 - files_mindmap: 0.0.26 - fulltextsearch: 24.0.0 - integration_twitter: 1.0.3 - suspicious_login - timetracker: 0.0.76 - user_ldap - welcome: 1.0.2
```
### Nextcloud Signing status
```shell
No errors have been found.
```
### Nextcloud Logs
```shell
{"reqId":"TdOINZmZOsVkcEtbwmBI","level":3,"time":"2023-03-03T19:30:03+00:00","remoteAddr":"91.49.60.117","user":"rfreytag","app":"PHP","method":"GET","url":"/core/preview?fileId=248461&c=63f18a1258d37&x=250&y=250&forceIcon=0&a=0","message":"imagecreatefromstring(): Data is not in a recognized format at /usr/share/webapps/nextcloud/lib/private/legacy/OC_Image.php#758","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/110.0","version":"25.0.4.1","exception":{"Exception":"Error","Message":"imagecreatefromstring(): Data is not in a recognized format at /usr/share/webapps/nextcloud/lib/private/legacy/OC_Image.php#758","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/usr/share/webapps/nextcloud/lib/private/legacy/OC_Image.php","line":758,"function":"imagecreatefromstring","args":["*** sensitive parameters replaced ***"]},{"file":"/usr/share/webapps/nextcloud/lib/private/Preview/Image.php","line":52,"function":"loadFromFile","class":"OC_Image","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/Preview/GeneratorHelper.php","line":65,"function":"getThumbnail","class":"OC\\Preview\\Image","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/Preview/Generator.php","line":343,"function":"getThumbnail","class":"OC\\Preview\\GeneratorHelper","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/Preview/Generator.php","line":162,"function":"getMaxPreview","class":"OC\\Preview\\Generator","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/Preview/Generator.php","line":114,"function":"generatePreviews","class":"OC\\Preview\\Generator","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/PreviewManager.php","line":185,"function":"getPreview","class":"OC\\Preview\\Generator","type":"->"},{"file":"/usr/share/webapps/nextcloud/core/Controller/PreviewController.php","line":144,"function":"getPreview","class":"OC\\PreviewManager","type":"->"},{"file":"/usr/share/webapps/nextcloud/core/Controller/PreviewController.php","line":113,"function":"fetchPreview","class":"OC\\Core\\Controller\\PreviewController","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":225,"function":"getPreviewByFileId","class":"OC\\Core\\Controller\\PreviewController","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":133,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/AppFramework/App.php","line":172,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/usr/share/webapps/nextcloud/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/usr/share/webapps/nextcloud/lib/base.php","line":1047,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/usr/share/webapps/nextcloud/index.php","line":36,"function":"handleRequest","class":"OC","type":"::"}],"File":"/usr/share/webapps/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"}}
```
### Additional info
_No response_