• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.3 Invalid image type while rebuilding attachments

Renegade

Well-known member
#1
I ran rebuild attachments and it got stuck with the following error. Now I cannot install or uninstall anything till this rebuild is complete. How do I resolve this?

Code:
XenForo_Exception: Invalid image type given. Expects IMAGETYPE_XXX constant. - library/XenForo/Image/Gd.php:100
Generated By: Admin, 2 minutes ago
Stack Trace
#0 [internal function]: XenForo_Image_Gd::createFromFileDirect('/home/techencl/...', 6)
#1 /home/techencl/public_html/community/library/XenForo/Image/Abstract.php(254): call_user_func(Array, '/home/techencl/...', 6)
#2 /home/techencl/public_html/community/library/XenForo/Deferred/AttachmentThumb.php(38): XenForo_Image_Abstract::createFromFile('/home/techencl/...', 6)
#3 /home/techencl/public_html/community/library/XenForo/Model/Deferred.php(256): XenForo_Deferred_AttachmentThumb->execute(Array, Array, 7.99999403954, '')
#4 /home/techencl/public_html/community/library/XenForo/Model/Deferred.php(390): XenForo_Model_Deferred->runDeferred(Array, 7.99999403954, '', false)
#5 /home/techencl/public_html/community/library/XenForo/Model/Deferred.php(335): XenForo_Model_Deferred->_runInternal(Array, NULL, '', false)
#6 /home/techencl/public_html/community/library/XenForo/ControllerAdmin/Tools.php(159): XenForo_Model_Deferred->run(true, NULL, '', false)
#7 /home/techencl/public_html/community/library/XenForo/FrontController.php(347): XenForo_ControllerAdmin_Tools->actionRunDeferred()
#8 /home/techencl/public_html/community/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#9 /home/techencl/public_html/community/admin.php(13): XenForo_FrontController->run()
#10 {main}
 

Brogan

XenForo moderator
Staff member
#2
Are you able to determine which actual image it is from the full stack trace?
Does it give the complete path?
 

Mike

XenForo developer
Staff member
#3
It appears to be a BMP file, but the system is saying that it already had a thumb generated.

Just to check, do you have any add-ons that accept attachments?
 

Renegade

Well-known member
#4
Are you able to determine which actual image it is from the full stack trace?
Does it give the complete path?
I am not sure how to do that. It doesn't show in the error logs.

It appears to be a BMP file, but the system is saying that it already had a thumb generated.

Just to check, do you have any add-ons that accept attachments?
I have the following add-ons installed that have anything to do with attachments
  • Convert image all - converts linked images to attachments
  • sonnb - XenGallery - image gallery for xenforo which imports attachments into gallery
  • [oxy] News Portal - picks up attachments and resizes to show on portal
 

AndyB

Well-known member
#5
I just checked my add-on "Convert Image All" and it does convert hot linked bmp images to attachments.

You can use phpMyAdmin to find bmp images. Run this SQL query in phpMyAdmin.

Code:
SELECT xf_attachment_data.data_id, xf_attachment_data.filename, xf_attachment.attachment_id, xf_attachment.content_id
FROM xf_attachment_data
INNER JOIN xf_attachment ON xf_attachment.data_id = xf_attachment_data.data_id
WHERE filename LIKE '%bmp%'
Each file that ends with .bmp file will need to be converted to a jpg.

Use the content_id number which is the post number to go to the post. Once at the post, either delete or convert the bmp to a jpg.

On my server I had three bmp files out of 350,000 attachments, hopefully yours will only have one or two also.
 
Last edited:

Mike

XenForo developer
Staff member
#7
It's ok if it converts it -- but it can't thumbnaili it unexpectedly (that would require some forced manipulation I think).

(We could potentially support bmp without a significant issue, but seriously - don't use bmp on the internet. It's like using a wav file instead of an mp3.)

I would be curious about the file in question and how it got into the system though, so that query is useful, though I'd probably run:

Code:
SELECT xf_attachment_data.*, xf_attachment.attachment_id, xf_attachment.*
FROM xf_attachment_data
INNER JOIN xf_attachment ON xf_attachment.data_id = xf_attachment_data.data_id
WHERE filename LIKE '%.bmp'
So we get the full details.
 

AndyB

Well-known member
#8
I would be curious about the file in question and how it got into the system though.
At this time my add-on "Convert Image All" will convert all image files, that's how it got into the system. The add-on takes hot linked images and makes them into attachments.
 

Renegade

Well-known member
#11
Data from the query. Assuming you dont need the headers. :p

Code:
4123;"32237";"1258859789";"proof.bmp";"13582";"34d2ed45b9dc68b2d811d1c26c6afe30";"0";"0";"0";"0";"1";"4173";"4173";"4123";"post";"926566";"1258859789";;"0";"23"
10855;"26639";"1336042286";"MsInfo.bmp";"1769526";"cc3c7e66f9bdca9642390792a17e9bf3";"0";"0";"0";"0";"1";"11563";"11563";"10855";"post";"1638640";"1336042286";;"0";"24"
10856;"26639";"1336042815";"Msinfo 1.bmp";"1769526";"ea5e514360b4df2c7dded3bc2846d757";"0";"0";"0";"0";"1";"11564";"11564";"10856";"post";"1638640";"1336042815";;"0";"10"
10857;"26639";"1336043378";"MSinfo 2.bmp";"1769526";"d8d037776372ab8913f2bd55a3a48d04";"0";"0";"0";"0";"1";"11565";"11565";"10857";"post";"1638640";"1336043378";;"0";"6"
10858;"26639";"1336043823";"Msinfo 3.bmp";"1769526";"534de93d35bbc4e136c6fa78f3222f22";"0";"0";"0";"0";"1";"11566";"11566";"10858";"post";"1638640";"1336043823";;"0";"9"
10875;"26639";"1336244784";"msinfo2.bmp";"1969206";"f2f60922ecff2f61e2088f6d68c733d8";"0";"0";"0";"0";"1";"11599";"11599";"10875";"post";"1640131";"1336244784";;"0";"7"
10876;"26639";"1336245030";"msinfo3.bmp";"1956918";"6a18e62df18eb31a7ab58ee5425a2fe7";"0";"0";"0";"0";"1";"11600";"11600";"10876";"post";"1640131";"1336245030";;"0";"9"
10877;"26639";"1336246127";"msinfo4.bmp";"1963062";"aae6c233e7f6c9cdb1c3a22f48995ed4";"0";"0";"0";"0";"1";"11601";"11601";"10877";"post";"1640131";"1336246127";;"0";"7"
32379;"1";"1394230096";"Phone.bmp";"173622";"07c10ba0767b03fc0fd07f55f3f421d3";"602";"96";"100";"16";"1";"35115";"35115";"32379";"post";"1902167";"1394230096";;"0";"2"
32383;"1";"1394230098";"Phone.bmp";"173622";"07c10ba0767b03fc0fd07f55f3f421d3";"602";"96";"100";"16";"1";"35119";"35119";"32383";"post";"1902167";"1394230098";;"0";"2"