Error loading image / Fehler beim Laden von Bildern

Nextcloud version (eg, 20.0.5): 24.0.6
Operating system and version (eg, Ubuntu 20.04): CentOS
Apache or nginx version (eg, Apache 2.4.25): 2.4.6 (CentOS)
PHP version (eg, 7.4): 8.1.11

The issue you are facing:

I’m not able to generate and see thumbnails images nor videos and after clicking on it the image didn’t open as preview.

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

Steps to replicate it:

  1. every image/video-file

The output of your Nextcloud log in Admin > Logging:

[PHP] Fehler: Error: imagecreatefromstring(): Couldn't create GD Image Stream out of Data at /var/www/vhosts/PATH2CLOUD/lib/private/legacy/OC_Image.php#758 at <<closure>>

 0. <<closure>>
    OC\Log\ErrorHandler::onError()
 1. /var/www/vhosts/PATH2CLOUD/lib/private/legacy/OC_Image.php line 758
    imagecreatefromstring("*** sensitive parameters replaced ***")
 2. /var/www/vhosts/PATH2CLOUD/lib/private/Preview/Image.php line 52
    OC_Image->loadFromFile()
 3. /var/www/vhosts/PATH2CLOUD/lib/private/Preview/GeneratorHelper.php line 65
    OC\Preview\Image->getThumbnail()
 4. /var/www/vhosts/PATH2CLOUD/lib/private/Preview/Generator.php line 335
    OC\Preview\GeneratorHelper->getThumbnail()
 5. /var/www/vhosts/PATH2CLOUD/lib/private/Preview/Generator.php line 159
    OC\Preview\Generator->getMaxPreview()
 6. /var/www/vhosts/PATH2CLOUD/lib/private/Preview/Generator.php line 111
    OC\Preview\Generator->generatePreviews()
 7. /var/www/vhosts/PATH2CLOUD/lib/private/PreviewManager.php line 212
    OC\Preview\Generator->getPreview()
 8. /var/www/vhosts/PATH2CLOUD/apps/files_sharing/lib/Controller/PublicPreviewController.php line 120
    OC\PreviewManager->getPreview()
 9. /var/www/vhosts/PATH2CLOUD/lib/private/AppFramework/Http/Dispatcher.php line 225
    OCA\Files_Sharing\Controller\PublicPreviewController->getPreview()
10. /var/www/vhosts/PATH2CLOUD/lib/private/AppFramework/Http/Dispatcher.php line 133
    OC\AppFramework\Http\Dispatcher->executeController()
11. /var/www/vhosts/PATH2CLOUD/lib/private/AppFramework/App.php line 172
    OC\AppFramework\Http\Dispatcher->dispatch()
12. /var/www/vhosts/PATH2CLOUD/lib/private/Route/Router.php line 298
    OC\AppFramework\App::main()
13. /var/www/vhosts/PATH2CLOUD/lib/base.php line 1030
    OC\Route\Router->match()
14. /var/www/vhosts/PATH2CLOUD/index.php line 36
    OC::handleRequest()

GET /index.php/apps/files_sharing/publicpreview/wbbCT9YF9a7Nx4r?file=/IMG_0869.jpg&fileId=131783&x=1920&y=1080&a=true
from 87.186.30.14 at 2022-10-13T18:10:52+00:00

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => '',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => '',
    1 => '',
  ),
  'datadirectory' => '/var/www/vhosts/_PATH2DATA',
  'dbtype' => 'mysql',
  'version' => '24.0.6.1',
  'overwrite.cli.url' => '',
  'dbname' => '',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '',
  'dbpassword' => '',
  'installed' => true,
  'default_phone_region' => 'DE',
  'default_language' => 'de',
  'default_locale' => 'de_DE',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'info',
  'mail_domain' => '',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'mailserver',
  'mail_smtpport' => '587',
  'mail_smtpname' => '',
  'mail_smtppassword' => '',
  'enable_previews' => true,
  'preview_max_x' => 4096,
  'preview_max_y' => 4096,
  'preview_max_filesize_image' => 50,
  'preview_max_memory' => 2048,
  'enabledPreviewProviders' =>
  array (
    0 => 'OC\\Preview\\PNG',
    1 => 'OC\\Preview\\JPEG',
	2 => 'OC\\Preview\\GIF',
    3 => 'OC\\Preview\\BMP',
    4 => 'OC\\Preview\\XBitmap',
    5 => 'OC\\Preview\\MP3',
    6 => 'OC\\Preview\\TXT',
    7 => 'OC\\Preview\\MarkDown',
    8 => 'OC\\Preview\\OpenDocument',
    9 => 'OC\\Preview\\Krita',
    10 => 'OC\\Preview\\JPG',
  ),
  'twofactor_enforced' => 'true',
  'twofactor_enforced_groups' =>
  array (
    0 => 'admin',
    1 => 'mfa_enforce',
  ),
  'twofactor_enforced_excluded_groups' =>
  array (
  ),
  'app_install_overwrite' =>
  array (
    0 => 'backup',
  ),
);

I had the problem because I had 2 lines in the config that should allow me to display larger images, which I had deleted, maybe it’s your problem because of them? 0 => ‘OC\Preview\PNG’,
1 => ‘OC\Preview\JPEG’,
2 => ‘OC\Preview\GIF’,
3 => ‘OC\Preview\BMP’,
4 => ‘OC\Preview\XBitmap’,
5 => ‘OC\Preview\MP3’,
6 => ‘OC\Preview\TXT’,

@Mr.Zero
As much as I cherish your input here it would be nice (and mandatory as well) to keep to the language of the original poster.

Which is clearly english here :wink:

So I’d like to ask you to kindly translate your answer from above (as I don’t want to move this thread to the german subforum)?
If you don’t feel comfy posting english in public that would be no real problem. Just use deepl.com for your translations. This service usually does a good job (and comes for free as well).

Thank you in advance

im sorry, i have forgott to translate

1 Like

@bikmaek It seems your issue is similar (or identical?) to mine: Pictures in gallery cannot be displayed - #3 by shaaati

Do you also have the weird behavior that using the edit mode on an image temporarily makes it visible for you? It might seem that editing is not working because nothing happens, but if you close the file and reopen it the edit mode is shown (at least for me).