nextcloud / nextcloud/previewgenerator
Error: Method Intervention\Image\Image::__toString()
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 520
- Forks
- 55
- PR merge metrics
- No merged PRs in 30d
Description
Hi, my preview generation crashes and complains about the __toString() not returning a string value in /var/www/nextcloud/lib/private/legacy/OC_Image.php:647.
This is the stack trace:
2021-03-15T17:36:49+01:00 Scanning folder /user/files/Backups/MacBook Air/Backups/Applications/Address Book.app/Contents/Resources
An unhandled exception has been thrown:
Error: Method Intervention\Image\Image::__toString() must return a string value in /var/www/nextcloud/lib/private/legacy/OC_Image.php:647
Stack trace:
#0 /var/www/nextcloud/lib/private/legacy/OC_Image.php(647): imagecreatefromstring()
#1 /var/www/nextcloud/apps/camerarawpreviews/lib/RawPreviewBase.php(63): OC_Image->loadFromData()
#2 /var/www/nextcloud/apps/camerarawpreviews/lib/RawPreviewIProviderV2.php(25): OCA\CameraRawPreviews\RawPreviewBase->getThumbnailInternal()
#3 /var/www/nextcloud/lib/private/Preview/GeneratorHelper.php(63): OCA\CameraRawPreviews\RawPreviewIProviderV2->getThumbnail()
#4 /var/www/nextcloud/lib/private/Preview/Generator.php(244): OC\Preview\GeneratorHelper->getThumbnail()
#5 /var/www/nextcloud/lib/private/Preview/Generator.php(140): OC\Preview\Generator->getMaxPreview()
#6 /var/www/nextcloud/lib/private/PreviewManager.php(205): OC\Preview\Generator->generatePreviews()
#7 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(203): OC\PreviewManager->generatePreviews()
#8 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(174): OCA\PreviewGenerator\Command\Generate->parseFile()
#9 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(172): OCA\PreviewGenerator\Command\Generate->parseFolder()
#10 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(172): OCA\PreviewGenerator\Command\Generate->parseFolder()
#11 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(172): OCA\PreviewGenerator\Command\Generate->parseFolder()
#12 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(172): OCA\PreviewGenerator\Command\Generate->parseFolder()
#13 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(172): OCA\PreviewGenerator\Command\Generate->parseFolder()
#14 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(172): OCA\PreviewGenerator\Command\Generate->parseFolder()
#15 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(172): OCA\PreviewGenerator\Command\Generate->parseFolder()
#16 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(155): OCA\PreviewGenerator\Command\Generate->parseFolder()
#17 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(123): OCA\PreviewGenerator\Command\Generate->generateUserPreviews()
#18 /var/www/nextcloud/lib/private/User/Manager.php(571): OCA\PreviewGenerator\Command\Generate->OCA\PreviewGenerator\Command\{closure}()
#19 /var/www/nextcloud/apps/previewgenerator/lib/Command/Generate.php(124): OC\User\Manager->callForSeenUsers()
#20 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OCA\PreviewGenerator\Command\Generate->execute()
#21 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1000): Symfony\Component\Console\Command\Command->run()
#22 /var/www/nextcloud/3rdparty/symfony/console/Application.php(271): Symfony\Component\Console\Application->doRunCommand()
#23 /var/www/nextcloud/3rdparty/symfony/console/Application.php(147): Symfony\Component\Console\Application->doRun()
#24 /var/www/nextcloud/lib/private/Console/Application.php(215): Symfony\Component\Console\Application->run()
#25 /var/www/nextcloud/console.php(100): OC\Console\Application->run()
#26 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')
#27 {main}
Here is a zip of the folder it crashes on:
Resources.zip
I have had this error on other files as well. Would it help if I include the software versions I'm using?
Kind regards
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing preview generation with the attached Resources.zip and inspect lib/private/legacy/OC_Image.php:647, then follow the call from apps/camerarawpreviews/lib/RawPreviewBase.php:63. Check how the occ preview-generation command handles the failing input; done means the scan no longer terminates with an uncaught __toString() error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100