Can not upload large image in WP
- Edited
I tried to export it as png and jpeg and still getting same error
Im grabbing images from unsplash.com. Any image under 2560 pixels i have no issues. Anything above that, it fails.
twest Thanks for all the help. I appreciate it.
I stopped testing last night as I had other tasks to do.
I decided to look at it again this morning, and it has something to do with WP install, the hosting account or the server.
I have another fresh WP install on another server in my cluster and I had no issues there.
I will update once I figure this out.
OK I got the issue fixed. Not sure what the issue was exactly, but rebooting the server did the trick.
Andreas You are using openlitespeed ? maybe it was waiting for reload.
CloudyShaper No, I am using apache
set upload_max_filesize in php
I'm 99% sure this is caused by hitting the memory usage on the PHP container. The memory limit you configure covers all PHP processes as well as cron and any SSH sessions.
- Edited
Andreas What's their memory limit? Anything over 2560 is auto scaled down to 2560 by wordpress. Don't forget its also creating 4+ other image sizes (thumbail, etc). Scaling can be taxing on system resources.
If you have a low CPU limit on the site. That could cause it to fail if wordprss can't complete all the scaling fast enough.
Low memory will cause failure as image scaling requires memory. Higher the resolution + filesize the more memory.
Restarting the server probably freed up just enough memory for upload.
If you don't actually want an image over 2560 pixels on the site you should shrink it before uploading. The quality and filesize will be better than what wordpress scaling will produce.
What's their memory limit?
- 1GB
Anything over 2560 is auto scaled down to 2560 by wordpress.
- I did not know this
Don't forget its also creating 4+ other image sizes (thumbail, etc).
- yes i seen as many as 11 (all depends on theme)
Scaling can be taxing on system resources.
- yes, I use the plugin called EWWW to disable all the acaling
If you have a low CPU limit on the site. That could cause it to fail if wordprss can't complete all the scaling fast enough.
- I have 1 core set for the package in enhance. these are AMD Ryzen cores
Low memory will cause failure as image scaling requires memory. Higher the resolution + filesize the more memory.
- that makes sense
Restarting the server probably freed up just enough memory for upload.
- I had lots of memory available it wasnt one account. it was 3 accounts i tried on the server.
The whole purpose of this was not for me, but for my users.
General users dont know when you upload an image, WP will save it, and then create 4 to 10+ versions of it.
So they still have an un-optimized image, a ton of extra images they wll no use that just take up space for nothing.
So I have been using EWWW for a couple years now, to prevent all that. Keeps my and my users sites much cleaner, optimized.
- Edited
Andreas Interesting. My experience of EWWW has been that it can be resource heavy unless you pay for their cloud service because it tries to "compress" the image. I understand what you mean about users not knowing better. I've seen people put 10MB photoshop exports on the homepage. No joke it was like 8,000 pixels or something lol.
1GB should be enough on a low traffic site. 1 Ryzen core should also be enough (assuming you're not overselling). As a test could you temporarly give them 2GB and 2 cores? Upload a large image and see what happens.
yes i seen as many as 11 (all depends on theme)
Or even more than that lol. Its insane and honestly wordpress scaling generates larger than necessary files. Fortunately webp is a thing. I should know this but im not sure if they is done concurrently or sequentially. If its doing 11 concurrently and using the original image for all scaling thats a lot of memory. I should know this but never looked at the code. Maybe someone else knows?
"unless you pay for their cloud service "
interesting. i never thought about that. That would help, but its not happening all the time.,
I do have a lifetime account i got from appsumo. I just never use it as the free version of EWWW does all that I need.
If this error comes up again, I may try that to see if that works.
- Edited
Andreas Yeah just remember after wordpress generates the different sizes, ewww then is optimizing each size which takes resources too, especially if its not just compressing the jpg/png but also generating a webp version. Pretty sure ewww is pretty CPU heavy.
The paid version compresses on their servers and has better compression (according to them but it probably does and probably uses GPU not CPU).
I have only seen this "The response is not a valid JSON response" on wordpress, because of ModSecurity before. But i see you have already checked that.
Hey guys,
I have a similar problem. I can't upload images bigger than 3 MB to my site. The error message says, "The server can't process the image. This can happen if the server is busy or doesn't have enough resources. Uploading a smaller image might work. The maximum suggested size is 2,560 pixels." You can see my PHP configuration here: https://www.rockstarauctionhouse.com/info.php.
My host is aws ec2 instance and the server has a 1 core Intel(R) Xeon(R) CPU E5-2676 and a lot of swap memory. I found that the issue happens only when I try to upload images larger than 3 MB. Smaller images upload fine. But this shouldn't be happening, right? I have tried out everything discussed in this chart. Doesn't work.
Thanks in advance
webdev1903 What is the resolution of this 3MB image?
webdev1903 My host is aws ec2 instance
That CPU is from 2015 and does't have good single thread performance. Enhance min specs is two cores and I assume they mean two cores on a modern CPU. Your server probably needs a more powerful CPU to handle everything.
Heztner is a good reliable option that will be MUCH faster for the same price. AWS is really overpriced unless you are making use of their entire ecosystem or prepay years in advance.