XF 1.4 XenForo_Exception: Invalid image type given. Expects IMAGETYPE_XXX constant

Joe Link

Well-known member
I tried to rebuild my Attachment Thumbnail Cache this morning on one of my forums, and I received this error. The Attachment Thumbnail Cache's for other forums hosted on the same server rebuilt without issue, so I'm thinking maybe a specific file is holding it up? There is no mention in the Apache error log.

Code:
Server Error Log

Error Info
XenForo_Exception: Invalid image type given. Expects IMAGETYPE_XXX constant. - library/XenForo/Image/ImageMagick/Pecl.php:85

Stack Trace
#0 [internal function]: XenForo_Image_ImageMagick_Pecl::createFromFileDirect('/home/publ...', 6)
#1 /home/public_html/library/XenForo/Image/Abstract.php(254): call_user_func(Array, '/home/publ...', 6)
#2 /home/public_html/library/XenForo/Deferred/AttachmentThumb.php(38): XenForo_Image_Abstract::createFromFile('/home/publ...', 6)
#3 /home/public_html/library/XenForo/Model/Deferred.php(294): XenForo_Deferred_AttachmentThumb->execute(Array, Array, 7.99999904633, '')
#4 /home/public_html/library/XenForo/Model/Deferred.php(428): XenForo_Model_Deferred->runDeferred(Array, 7.99999904633, '', false)
#5 /home/public_html/library/XenForo/Model/Deferred.php(373): XenForo_Model_Deferred->_runInternal(Array, NULL, '', false)
#6 /home/public_html/library/XenForo/ControllerAdmin/Tools.php(159): XenForo_Model_Deferred->run(true, NULL, '', false)
#7 /home/public_html/library/XenForo/FrontController.php(347): XenForo_ControllerAdmin_Tools->actionRunDeferred()
#8 /home/public_html/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#9 /home/public_html/admin.php(13): XenForo_FrontController->run()
#10 {main}

Request State
array(3) {
["url"] => string(62) "https://www.domain.com/admin.php?tools/run-deferred"
["_GET"] => array(1) {
["tools/run-deferred"] => string(0) ""
}
["_POST"] => array(3) {
["redirect"] => string(43) "https://www.domain.com/admin.php"
["execute"] => string(1) "1"
["_xfToken"] => string(8) "********"
}
}
 
Last edited:
This is actually changed for 1.4.5 to prevent this error from blocking the whole process. If you can wait until that (which likely won't be that long), it'd be the easiest solution.

It's caused by a specific image that has a thumbnail that really shouldn't because it's not a format we support thumbnailing. This is generally only something that comes up with add-ons.
 
Thank you for the reply Mike. The rebuilding of the thumbnails wasn't much of an issue, but it was also causing incomplete add-on updates (according to the error message, not sure if it was serious).

@AndyB had me edit the Pecl.php ImageMagick file, appending the error line so it returned the file name of the offending thumbnail. There were actually 10 or so (of 150k+), which I deleted. Everything is working as normal now :)
 
Back
Top Bottom