Jump to content

Can no longer add images to products "Unexpected token <"


katiam

Recommended Posts

Hi,

 

All of a sudden, I can no longer add images to products. When I try to, the browser seems to become "unresponsive", if I wait it returns an error "Unexpected token <". Sometimes it will have theoretically added an image, it will list a new question mark image placeholder.

 

  • I have checked file permissions on img/p folder & subdirectories, they are 777
  • I have tried and have same prob in chrome, ffox and internet explorer
  • I have checked and I have not exceeded disk or bandwidth quotas on my server
  • The files I am uploading aren't excessively large- they average 4mb and are JPGs.

 

Anyone else have this problem?

 

Any ideas???

 

Help would be most appreciated!! thx.

Link to comment
Share on other sites

Katiam, folders permission should always be 755 (644 for files) 

Have you added a new non-PS module recently? If this is the case, try to disable it.

 

Then, always, turn your cache off in B.O. > Advanced Parameters > Performance

 

IEdited to add: if the error is still there, copy the full info about it here.

 

Then come back and tell us!

Edited by nutxlago (see edit history)
  • Like 1
Link to comment
Share on other sites

Thank you nutxlago, appreciate your help.

 

I chose the "disable all non-prestashop module" option in the advanced parameters> performance settings and have also disabled the site cache. Still no luck.

I tried in firefox again just because, same thing happens however it gives a better error message:

"JSON.parse: unexpected character at line 1 column 1 of the JSON data"

 

Ahh ok, I enabled console in developer tools, and the response from the ajax request is:

"<br />

<b>Fatal error</b>: Allowed memory size of 67108864 bytes exhausted (tried to allocate 17280 bytes) in <b>/home/goodasnethreads/public_html/classes/ImageManager.php</b> on line <b>384</b><br />"

 

How do I increase memory size, is this an apache thing or mysql thing?

 

thanks again for the help, really appreciate it!

Link to comment
Share on other sites

Glad you have solved your issue with images, Katiam!  :)

Anyway, you would try to reduce your images weight. 4mb is far too much weight for an image, even for a very big and quality one. They would be ok for a fast internet connection, but your store will be hard to be seen on mobiles and public wi-fi connections.

Good luck!

Link to comment
Share on other sites

  • 1 month later...

So, I've solved this- added a line to the config.inc.php file:

ini_set('memory_limit', '256M');

 

Not sure what the memory limit was, but this did the trick. Might squish my images a bit more in future too.

I've tested it but nothing happen. I still got "Unexpected Token<" when I tried to upload image to product (It worked fine when I test all website on my localhost, after I upload all website to VPS, I got this error)

Is there anyone facing this issue and help me how to solve it, I'm very appreciated that

Link to comment
Share on other sites

  • 3 weeks later...

The same problem happens to me and I found a simple solution that always works.

I am not a programmer, I didn't change the code, I didn't modify the CSV file.

 

My preferred browser is Chrome, so when the problems appears, I just start Firefox and login into my website.

I don't understand the reason, I don't know the cause, I just change from Chrome to Firefox.

It's that simple for me!!

 

Both my Chrome and FIrefox are updated automatically.... I don't think the issue is related to the browser version. I don't think it is related to the CSV file.... I am not a programmer but I think it is an issue with PrestaShop code.

 

Good luck

Navid

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...