cancel
Showing results for 
Search instead for 
Did you mean: 

Uploading Product Image fails Get Decoding Failed: Syntax Error message

Uploading Product Image fails Get Decoding Failed: Syntax Error message

Hello,

 

I am tryin gto upload an image for a product.

 I can Browse to the file I want, Select it, and can click Upload Files.  It appears to upload as it shows up when I rollover its box.  I then select it for Base Image, Small Image, & Thumbnail.  But when I click "Save", I get the error message "Decoding Failed: Syntax Error" and removes the image from the list.

 

I've updated Chrome, cleared my cache, verified that Flash is enabled.  And I'm running 1.9.2.4

Anyone have this problem before?  If so, how did you resolve?

 

Thanks in advance. 

5 REPLIES

Re: Uploading Product Image fails Get Decoding Failed: Syntax Error message

Hi @twallmagento

 

Do you see any error messages in the system.log and exception.log file?

---
Problem Solved Click Accept as Solution!:Magento Community India Forum

Re: Uploading Product Image fails Get Decoding Failed: Syntax Error message

Yes, thanks.  Here is what I see in the exceptions.log :

 

2016-08-02T20:09:30+00:00 ERR (3):

exception 'Mage_Eav_Model_Entity_Attribute_Exception' with message 'Decoding failed: Syntax error' in /app/code/core/Mage/Core/Model/Config.php:1354

Stack trace:

#0 /app/Mage.php(463): Mage_Core_Model_Config->getModelInstance('eav/entity_attr...', 'Decoding failed...')

#1 /app/code/core/Mage/Eav/Model/Entity/Abstract.php(661): Mage::getModel('eav/entity_attr...', 'Decoding failed...')

#2 /app/code/core/Mage/Eav/Model/Entity/Abstract.php(1648): Mage_Eav_Model_Entity_Abstract->walkAttributes('backend/beforeS...', Array)

#3 /app/code/core/Mage/Catalog/Model/Resource/Product.php(181): Mage_Eav_Model_Entity_Abstract->_beforeSave(Object(Mage_Catalog_Model_Product))

#4 /app/code/core/Mage/Eav/Model/Entity/Abstract.php(1122): Mage_Catalog_Model_Resource_Product->_beforeSave(Object(Mage_Catalog_Model_Product))

#5 /app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Eav_Model_Entity_Abstract->save(Object(Mage_Catalog_Model_Product))

#6 /app/code/core/Mage/Adminhtml/controllers/Catalog/ProductController.php(728): Mage_Core_Model_Abstract->save()

#7 /app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_Catalog_ProductController->saveAction()

#8 /app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('save')

#9 /app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))

#10 /app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()

#11 /app/Mage.php(684): Mage_Core_Model_App->run(Array)

#12 /index.php(85): Mage::run('', 'store')

#13 {main}

 

 

Re: Uploading Product Image fails Get Decoding Failed: Syntax Error message

I'm having the same problem. Were you able to fix yours?

Re: Uploading Product Image fails Get Decoding Failed: Syntax Error message

My issue was caused by a custom version of /app/code/core/Mage/Core/Model/Config.php (in /app/code/local/Mage/Core/Model). I created this file for special use cases on an old store version. I have removed this file and am now able to add/save images on products with no errors.

Unfortunately, this doesn't seem like it would help you because you're not using a custom file.... but hopefully it helps someone else.

 

Edit: Make sure you're using the most recent version of /app/code/core/Mage/Core/Model/Config.php. Downloaded a fresh copy of your store version and compare the two files - maybe it didn't get updated that last time you ran an update.

Re: Uploading Product Image fails Get Decoding Failed: Syntax Error message

I didn't actually fix the problem, but I discovered what the actual problem is. This error only happens when a quote is the image 'Label' field.

 

I discovered this when looking at Chrome DevTools Console - whenever the error would appear, the JSON that handles the images would be malformed and missing a lot of information. The first error I saw was: "Unexpected token × in JSON at position 106." The Label for the image is: "24" × 24" sign." Whatever character appears after the converted " is the "Unexpected token".

 

Why is this happening? It seems to be caused by Magento parsing the images into JSON and not properly escaping the input.

 

How can I fix this? I don't know, still digging into the problem. A temporary workaround is to avoid using " in your label field.