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

imagesavealpha() expects parameter 1 to be resource, boolean given #20913

Closed
zsbolyoczki opened this issue May 11, 2020 · 4 comments · Fixed by #28485
Closed

imagesavealpha() expects parameter 1 to be resource, boolean given #20913

zsbolyoczki opened this issue May 11, 2020 · 4 comments · Fixed by #28485

Comments

@zsbolyoczki
Copy link

Steps to reproduce

Most probably relates to thumbnail generation:

sudo -u www-data php occ preview:generate-all

The exact message is:

imagesavealpha() expects parameter 1 to be resource, boolean given at ***/lib/private/legacy/image.php#571
imagesavealpha() expects parameter 1 to be resource, boolean given at ***/lib/private/legacy/image.php#572

Operating system:
Ubuntu 18.04.4 LTS

Web server:
apache2 - 2.4.29-1ubuntu4.13

Database:
mysql-5.7

PHP version:
php7.2-fpm

imagemagick 8:6.9.7.4+dfsg-16ubuntu6.8

Nextcloud version: (see Nextcloud admin page)
18.0.4 (currently the latest)

Updated from an older Nextcloud/ownCloud or fresh install:
started years ago and upgrading since then

Where did you install Nextcloud from:
official site

Signing status:

No errors have been found.

List of activated apps:

Enabled:
  - activity: 2.11.0
  - calendar: 2.0.3
  - cloud_federation_api: 1.1.0
  - contacts: 3.3.0
  - dav: 1.14.0
  - federatedfilesharing: 1.8.0
  - files: 1.13.1
  - files_fulltextsearch: 1.4.2
  - files_fulltextsearch_tesseract: 1.4.1
  - files_markdown: 2.2.0
  - files_mindmap: 0.0.21
  - files_rightclick: 0.15.2
  - files_sharing: 1.10.1
  - files_trashbin: 1.8.0
  - files_versions: 1.11.0
  - files_videoplayer: 1.7.0
  - firstrunwizard: 2.7.0
  - fulltextsearch: 1.4.1
  - fulltextsearch_elasticsearch: 1.5.1
  - logreader: 2.3.0
  - lookup_server_connector: 1.6.0
  - nextcloud_announcements: 1.7.0
  - notes: 3.3.0
  - notifications: 2.6.0
  - oauth2: 1.6.0
  - ocr: 6.0.37
  - password_policy: 1.8.0
  - passwords: 2020.5.0
  - photos: 1.0.0
  - previewgenerator: 2.3.0
  - privacy: 1.2.0
  - provisioning_api: 1.8.0
  - ransomware_protection: 1.6.1
  - settings: 1.0.0
  - sharebymail: 1.8.0
  - spreed: 8.0.8
  - tasks: 0.12.2
  - text: 2.0.0
  - theming: 1.9.0
  - twofactor_backupcodes: 1.7.0
  - updatenotification: 1.8.0
  - viewer: 1.2.0
  - workflowengine: 2.0.0

Nextcloud configuration:
What exact part is needed?

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

Are you using encryption: yes/no
No.

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

Client configuration

Browser:
N/A

Operating system:
N/A

Logs

Web server error log

Nothing related.

Browser log

N/A

@zsbolyoczki zsbolyoczki added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels May 11, 2020
@kesselb
Copy link
Contributor

kesselb commented May 11, 2020

A image is broken. We can't create a preview. Yep we should check if a resource is given for imagesavealpha.

@szaimen
Copy link
Contributor

szaimen commented Jun 7, 2021

Is this Issue still valid in NC21.0.2? If not, please close this issue. Thanks! :)

@ghost
Copy link

ghost commented Jul 7, 2021

This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.

@ghost ghost added the stale Ticket or PR with no recent activity label Jul 7, 2021
@ghost ghost closed this as completed Jul 21, 2021
@simonspa
Copy link
Contributor

Yes, just appeared again yesterday on my instance with NC21.0.4:

[PHP] Error: Error: imagesavealpha() expects parameter 1 to be resource, bool given at /var/www/nextcloud/lib/private/legacy/OC_Image.php#589 at <<closure>>

 0. <<closure>>
    OC\Log\ErrorHandler::onError(2, "imagesavealpha( ... n", "/var/www/nextcl ... p", 589, {imagePath: "/ho ... 3})
 1. /var/www/nextcloud/lib/private/legacy/OC_Image.php line 589
    imagesavealpha(false, true)
 2. /var/www/nextcloud/lib/private/Preview/Image.php line 52
    OC_Image->loadFromFile("/home/data/next ... g")
 3. /var/www/nextcloud/lib/private/Preview/GeneratorHelper.php line 63
    OC\Preview\Image->getThumbnail(OC\Files\Node\File {}, 2048, 2048)
 4. /var/www/nextcloud/lib/private/Preview/Generator.php line 244
    OC\Preview\GeneratorHelper->getThumbnail(OC\Preview\PNG {}, OC\Files\Node\File {}, 2048, 2048)
 5. /var/www/nextcloud/lib/private/Preview/Generator.php line 140
    OC\Preview\Generator->getMaxPreview(OC\Files\SimpleFS\SimpleFolder {}, OC\Files\Node\File {}, "image/png", "")
 6. /var/www/nextcloud/lib/private/PreviewManager.php line 205
    OC\Preview\Generator->generatePreviews(OC\Files\Node\File {}, [{width: 32,heig ... "], "image/png")
 7. /var/www/nextcloud/apps/previewgenerator/lib/Command/PreGenerate.php line 217
    OC\PreviewManager->generatePreviews(OC\Files\Node\File {}, [{width: 32,heig ... "])
 8. /var/www/nextcloud/apps/previewgenerator/lib/Command/PreGenerate.php line 195
    OCA\PreviewGenerator\Command\PreGenerate->processFile(OC\Files\Node\File {})
 9. /var/www/nextcloud/apps/previewgenerator/lib/Command/PreGenerate.php line 163
    OCA\PreviewGenerator\Command\PreGenerate->processRow({id: "400781",ui ... "})
10. /var/www/nextcloud/apps/previewgenerator/lib/Command/PreGenerate.php line 131
    OCA\PreviewGenerator\Command\PreGenerate->startProcessing()
11. /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Command/Command.php line 255
    OCA\PreviewGenerator\Command\PreGenerate->execute(Symfony\Componen ... {}, Symfony\Componen ... {})
12. /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Application.php line 1009
    Symfony\Component\Console\Command\Command->run(Symfony\Componen ... {}, Symfony\Componen ... {})
13. /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Application.php line 273
    Symfony\Component\Console\Application->doRunCommand(OCA\PreviewGener ... {}, Symfony\Componen ... {}, Symfony\Componen ... {})
14. /var/www/nextcloud/apps/bookmarks/vendor/symfony/console/Application.php line 149
    Symfony\Component\Console\Application->doRun(Symfony\Componen ... {}, Symfony\Componen ... {})
15. /var/www/nextcloud/lib/private/Console/Application.php line 215
    Symfony\Component\Console\Application->run(Symfony\Componen ... {}, Symfony\Componen ... {})
16. /var/www/nextcloud/console.php line 100
    OC\Console\Application->run()
17. /var/www/nextcloud/occ line 11
    require_once("/var/www/nextcloud/console.php")

at 2021-08-17T22:00:03+02:00

@simonspa simonspa reopened this Aug 18, 2021
@ghost ghost removed the stale Ticket or PR with no recent activity label Aug 18, 2021
simonspa pushed a commit that referenced this issue Aug 18, 2021
@szaimen szaimen added 2. developing Work in progress and removed needs info 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Aug 18, 2021
juliusknorr added a commit that referenced this issue Aug 18, 2021
…ource

Fix #20913: Check image resource before attempting to preserve alpha
backportbot-nextcloud bot pushed a commit that referenced this issue Aug 18, 2021
backportbot-nextcloud bot pushed a commit that referenced this issue Aug 18, 2021
juliusknorr added a commit that referenced this issue Aug 19, 2021
[stable21] Fix #20913: Check image resource before attempting to preserve alpha
TSI-yogeshshejwadkar pushed a commit to nextmcloud/server that referenced this issue Sep 4, 2021
@blizzz blizzz mentioned this issue Sep 23, 2021
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants