Fixed problem when import gallery data from xenforo 2.1.1

Đoàn Hoàng Nam

Active member
Affected version
1.2.2
Code:
Error: Call to a member function resizeAndCrop() on null in src/addons/XFMG/Service/Album/ThumbnailGenerator.php at line 152
 
    
XFMG\Service\Album\ThumbnailGenerator->createAlbumThumbnail() in src/addons/XFMG/Job/AlbumThumb.php at line 55
  
XFMG\Job\AlbumThumb->run() in src/XF/Job/Atomic.php at line 38
  
XF\Job\Atomic->run() in src/XF/Job/Manager.php at line 253
  
XF\Job\Manager->runJobInternal() in src/XF/Job/Manager.php at line 195
  
XF\Job\Manager->runJobEntry() in src/XF/Job/Manager.php at line 111
  
XF\Job\Manager->runByIds() in src/XF/Admin/Controller/Tools.php at line 120
  
XF\Admin\Controller\Tools->actionRunJob() in src/XF/Mvc/Dispatcher.php at line 321
  
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 244
  
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 100
  
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 50
  
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2177
  
XF\App->run() in src/XF.php at line 390
  
XF::runApp() in admin.php at line 13
 
Thank you for reporting this issue. It has now been resolved and we are aiming to include it in a future XFMG release (2.1.2).

Change log:
When generating album thumbnails or setting an image as an avatar, prevent an unexpected error if an image cannot be edited.
Any changes made as a result of this issue being resolved may not be rolled out here until later.
 
This wasn't a bug with the importer, as such, but if the issue persists, please edit the file src/addons/XFMG/Service/Album/ThumbnailGenerator.php and find:
PHP:
/** @var \XF\Image\Gd|\XF\Image\Imagick $image */
$image = $imageManager->imageFromFile($itemTempFile);
And add directly below:
PHP:
if (!$image)
{
   continue;
}
 
Top Bottom