Editing an image can trigger a server error

Jeremy P

XenForo developer
Staff member
Affected version
XFMG 2.2.5
To reproduce:
  1. Edit any image in the gallery
  2. Zoom in very closely
  3. Choose crop mode and select a small area (less than a pixel)
  4. Attempt to save the edit

Tested with Imagick.
 
Tested with Imagick.
Similar with GD:

Code:
ValueError: imagecreatetruecolor(): Argument #1 ($width) must be greater than 0 src/XF/Image/Gd.php:97
Generated by: admin 1.2.2024 at 23:47
Stack trace
#0 src/XF/Image/Gd.php(97): imagecreatetruecolor(0.515357, 0.488606)
#1 src/addons/XFMG/Service/Media/ImageEditor.php(99): XF\Image\Gd->crop(0.515357, 0.488606, 319.583, 479.668)
#2 src/addons/XFMG/Service/Media/ImageEditor.php(127): XFMG\Service\Media\ImageEditor->_apply()
#3 src/addons/XFMG/Pub/Controller/Media.php(1483): XFMG\Service\Media\ImageEditor->save()
#4 src/XF/Mvc/Dispatcher.php(352): XFMG\Pub\Controller\Media->actionEditImage(Object(XF\Mvc\ParameterBag))
#5 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XFMG:Media', 'EditImage', Object(XF\Mvc\RouteMatch), Object(Sugo\MediaTools\XFMG\Pub\Controller\Media), NULL)
#6 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(Sugo\MediaTools\XFMG\Pub\Controller\Media), NULL)
#7 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#8 src/XF/App.php(2487): XF\Mvc\Dispatcher->run()
#9 src/XF.php(524): XF\App->run()
#10 index.php(20): XF::runApp('XF\\Pub\\App')
#11 {main}

And this one is with Imagick:

Code:
ImagickException: Invalid image geometry src/XF/Image/Imagick.php:137
Generated by: admin 1.2.2024 at 23:51
Stack trace
#0 src/XF/Image/Imagick.php(137): Imagick->thumbnailImage(0.75824, 0.798439, false, true)
#1 src/addons/XFMG/Service/Media/ImageEditor.php(99): XF\Image\Imagick->crop(0.75824, 0.798439, 344.882, 348.068)
#2 src/addons/XFMG/Service/Media/ImageEditor.php(127): XFMG\Service\Media\ImageEditor->_apply()
#3 src/addons/XFMG/Pub/Controller/Media.php(1483): XFMG\Service\Media\ImageEditor->save()
#4 src/XF/Mvc/Dispatcher.php(352): XFMG\Pub\Controller\Media->actionEditImage(Object(XF\Mvc\ParameterBag))
#5 src/XF/Mvc/Dispatcher.php(259): XF\Mvc\Dispatcher->dispatchClass('XFMG:Media', 'EditImage', Object(XF\Mvc\RouteMatch), Object(Sugo\MediaTools\XFMG\Pub\Controller\Media), NULL)
#6 src/XF/Mvc/Dispatcher.php(115): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(Sugo\MediaTools\XFMG\Pub\Controller\Media), NULL)
#7 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#8 src/XF/App.php(2487): XF\Mvc\Dispatcher->run()
#9 src/XF.php(524): XF\App->run()
#10 index.php(20): XF::runApp('XF\\Pub\\App')
#11 {main}
 
Back
Top Bottom