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

Can someone help me decipher this error

Renegade

Well-known member
#1
This is while uploading an image and saving it on a custom add-on I am using.

Error InfoXenForo_Exception: Invalid image type given. Expects IMAGETYPE_XXX constant. - library/XenForo/Image/Gd.php:92
Generated By: test, 9 minutes ago

Stack Trace
#0 [internal function]: XenForo_Image_Gd::createFromFileDirect('/tmp/pdtl3v...', NULL)
#1 /home/dks/public_html/testin/library/XenForo/Image/Abstract.php(181): call_user_func(Array, '/tmp/pdtl3v...', NULL)
#2 /home/dks/public_html/testin/library/PdTl/Model/PTUtils.php(485): XenForo_Image_Abstract::createFromFile('/tmp/pdtl3v...', NULL)
#3 /home/dks/public_html/testin/library/PdTl/ControllerPublic/PTHome/Category.php(88): PdTl_Model_PTUtils->saveImage(3, 'http://dxo....', 'tablets-icon.jp...')
#4 /home/dks/public_html/testin/library/XenForo/FrontController.php(335): ProdsTool_ControllerPublic_PTHome_Category->actionAdd()
#5 /home/dks/public_html/testin/library/XenForo/FrontController.php(132): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#6 /home/dks/public_html/testin/index.php(13): XenForo_FrontController->run()
#7 {main}
 

Chris D

XenForo developer
Staff member
#2
What's the add-on? Ideally the developer of that add-on would need to resolve the issue for you.

The error is suggesting that an image has been uploaded and it hasn't been able to read it for some reason. What has caused this issue to occur? Does it work with some images? Did it work on XF 1.1.x but not on XF 1.2?

One thing that could cause this is an image being corrupt so you should try some other images.
 

Renegade

Well-known member
#3
Yeah I will get in touch with the developer.

I get this error on both 1.1 and 1.2. However I get it on one server and a local installation but not on another server. There it works perfectly.

No, when it does not work it does not work with any images.
 

Chris D

XenForo developer
Staff member
#5
Could be file permissions.

It can't ascertain what the file type is and to do that it needs to read the file. If it can't read the file then it will throw that error.

If it can't read it, that could be related to disk space (maybe the file isn't written to the tmp directory), file permissions when writing to tmp or file permissions when reading from tmp.

That's just my guess right now based on the error. So it might be worth running it past your hosts too.
 

Renegade

Well-known member
#8
Ok I am a bit stumped on this. I have two test instances running on the same server and I get this error on one instance but not on the other. So it can't be due to the server.
 

Chris D

XenForo developer
Staff member
#9
Are both using the same image processor? In attachment options in the admin CP you can choose between GD and ImageMagick