Fixed Uploading animated gif

Code:
#0 src/XF/Pub/Controller/Account.php(454): XF\Service\User\Avatar->updateAvatar()
#1 src/XF/Mvc/Dispatcher.php(249): XF\Pub\Controller\Account->actionAvatar(Object(XF\Mvc\ParameterBag))
#2 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF:Account', 'Avatar', 'json', Object(XF\Mvc\ParameterBag), 'account', Object(XF\Pub\Controller\Account), NULL)
#3 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#4 src/XF/App.php(1845): XF\Mvc\Dispatcher->run()
#5 src/XF.php(328): XF\App->run()
#6 index.php(13): XF::runApp('XF\\Pub\\App')
#7 {main}
 
Does this only happen when uploading animated avatars? All animated avatars or just one? Is avatar uploading generally working ok?
 
Does this only happen when uploading animated avatars? All animated avatars or just one?
I tested it with multiple animated avatars. Sometimes uploading works well, but it takes a lot of time. Also uploaded the same avatar to Xenforo.com, no problems here. Existing animated avatars already uploaded in XF1.5 continue to work well.

Is avatar uploading generally working ok?
Additionally, there are no issues with uploading avatars.
 
Can you add the problematic GIF to a ZIP file and upload it to a post here please so we can do some testing?
 
Ok I can see what's happening now. We're suppressing this error:
Code:
ImagickException: corrupt image `/private/var/tmp/phpzVV9Yq' @ error/gif.c/ReadGIFImage/1388 src/XF/Image/Imagick.php:24
Note that we don't actually use Imagick here so it will appear to work fine, though only the "original" version which appears on the avatar overlay will appear to be animated. All of the resized versions such as those used in posts, user profile etc. will all be a still image.

There's not a lot we can do about the image itself, but we do probably need to handle the error better. We'll report back when that issue is resolved, but it won't enable the existing GIF image to work.

Incidentally, I found this GIF on Giphy which appears to work:
https://fat.gfycat.com/EvenSmoothJunco.gif

Though really the thing to remember with GIFs is that to resize them, Image Magick and XF has to resize each frame four times. This is a large file with lots of frames so you run the risk of hitting memory and/or execution time limits.
 
For the next release, we've changed the error message slightly to hint that it could be related to a corrupt image.
 
Back
Top Bottom