Upgrade 8.1.0 to 8.4.3 - need help
Permalink
After an upgrade from 8.1.0 to 8.4.3
Exception Occurred: /concrete/src/File/Image/BasicThumbnailer.php:374 Call to a member function make() on null (0)
Please help :-)
Exception Occurred: /concrete/src/File/Image/BasicThumbnailer.php:374 Call to a member function make() on null (0)
Please help :-)
No, but thanks.
The Debugger shows the error on the -> $config = $this->app->make('config'); Line.
public function getThumbnail($obj, $maxWidth, $maxHeight, $crop = false) { $config = $this->app->make('config'); if ($config->get('concrete.misc.basic_thumbnailer_generation_strategy') == 'async') { return $this->returnThumbnailObjectFromResolver($obj, $maxWidth, $maxHeight, $crop); } else { return $this->checkForThumbnailAndCreateIfNecessary($obj, $maxWidth, $maxHeight, $crop); } }
The Debugger shows the error on the -> $config = $this->app->make('config'); Line.
Do you call File/Image/BasicThumbnailer.php directly? If so, it needs to be resolved via the 'Container', to set the `app` property.
You'd use the thumbnailer e.g. via `$app->make('helper/image')`, to create an instance of the BasicThumbnailer class.
If you don't know, I'd suggest to search your custom code for 'BasicThumbnailer' occurrences, e.g. in the directories application/blocks and packages/.
You'd use the thumbnailer e.g. via `$app->make('helper/image')`, to create an instance of the BasicThumbnailer class.
If you don't know, I'd suggest to search your custom code for 'BasicThumbnailer' occurrences, e.g. in the directories application/blocks and packages/.
This is the code in My.php
public static function getImagesFromSet($fsName) { $thumbnailer = new BasicThumbnailer(); $images = array(); $files = Set::getFilesBySetName($fsName); if (count($files) > 0) { foreach ($files as $file) { /** * @var \Concrete\Core\Entity\File\File $file * @var Version $av */ $av = $file->getApprovedVersion(); if (strpos($av->getMimeType(), 'image') !== false) { $image = $thumbnailer->getThumbnail($file, 2400, 2400)->src; $images[] = $image; }
Viewing 15 lines of 19 lines. View entire code block.
You shouldn't be instantiating BasicThumbnailer like that. It needs to be instantiated via the container. See https://documentation.concrete5.org/developers/appendix/concrete5-ve...
In your case that might be `$app->make('helper/image')`, for example. But it really depends on the rest of your code.
In your case that might be `$app->make('helper/image')`, for example. But it really depends on the rest of your code.
Thanks A3020
I added
and in the function getImagesFromSet()
An it works, thanks!
I added
use Concrete\Core\Application\ApplicationAwareTrait;
and in the function getImagesFromSet()
$app = \Concrete\Core\Support\Facade\Application::getFacadeApplication(); $im = $app->make('helper/image');
An it works, thanks!
The trait is only useful if your class is also instantiated via the Container. Otherwise the `app` property won't be set.
The facade you're using now, is an OK solution.
The facade you're using now, is an OK solution.
https://github.com/concrete5/concrete5/issues/7113...
There is already a pull request.