Jump to content

[Solved] Cannot upload small images


psy
 Share

Recommended Posts

There are many forum topics and suggested solutions to problems uploading images in PW admin. I've read all I can find but none address the problem I'm experiencing. It's consistent and repeatable.

I have an image field in my template (duh!) and I can successfully upload any images with an approved image file type that has a file size over 10kb. Any images (png or jpg in this case) with file size of <10kb fail with the following error:

image.jpeg.5ff3bc523b030a8c00acc60c28a104b7.jpeg

I have even taken one of the small images, given it a bigger canvas in Photoshop, converted to PNG/JPG and successfully uploaded it. I could also hack it and make all my images bigger then use the api/image variations to reduce them on frontend output but that's not the point and a lot of unnecessary effort and wasted disk storage.

Suggestions on how to fix the underlying problem most welcome.

TIA

Solved

Thanks @netcarver for suggesting it may be a ModSecurity issue. Nailed it. Web host whitelisted my IP from their (obscure) rule and the uploads worked perfectly 🙂 

Edited by psy
Problem solved
Link to comment
Share on other sites

Looks like the ajax upload is leading to the 403 page being returned - html where json was expected. Question is why.  Do you have any custom (non standard PW) directives in your .htaccess file? What version of PW are you running there?  Other things - is this running on a platform with a WAF/Modsecurity or other front-end?

  • Like 1
Link to comment
Share on other sites

@netcarver

Using PW 3.0.210 and nothing special in .htaccess other than ProCache directives, https only and 

<IfModule mod_mime.c>
  AddType image/webp .webp
</IfModule>

Strange that it only happens on small images. No problem at all on larger image file sizes.

I changed the default image quality from 90% to 100% in case that made the file invalid but no difference. All PHP image processing modules seem OK.

As for ModSecurity, yes it's on a shared host that has ModSecurity. That's been a nightmare on many occasions for other things. I have the web host on speed dial. Good call to check that one.

Link to comment
Share on other sites

Could you provide a sample image?

And... could you please export the field so I can import it here and compare it?

My testing worked with a 1kb JPG pretty fine in PW 3.0.210.

smallimage.thumb.png.36150da6a2867c792bf1c561a715bbfa.png

Additional note:
Please open that image you try to upload and save/export it again as JPG or PNG.
I bet there is something wrong with the file itself.

  • Like 1
Link to comment
Share on other sites

  • psy changed the title to [Solved] Cannot upload small images
10 hours ago, wbmnfktr said:

Could you provide a sample image?

And... could you please export the field so I can import it here and compare it?

My testing worked with a 1kb JPG pretty fine in PW 3.0.210.

Additional note:
Please open that image you try to upload and save/export it again as JPG or PNG.
I bet there is something wrong with the file itself.

Thank you for investigating @wbmnfktr 🙂 

I had tried re-saving in different formats without success. It was only when I made one image bigger and it uploaded that I realised the file size was triggering the issue.

@netcarver's suggestion of a ModSecurity issue with the web host was 100% and nothing to do with PW.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...