• Resolved jicto

    (@jicto)


    Good day,

    We have encountered an error photo with too many pixels will be uploaded. The site will go unresponsive, and the photo needs to be deleted for this to be resolved.
    There is two cases which we tested. A photo of 11658×6112 (4mb) and 5568×11136 pixels (3mb). We also tested larger photos with smaller pixels, they gave no issue. So it was safe to say it was the amount of pixels that caused this.

    We would like to set a limit to the pixel size and mb size for a user to upload a photo, but we are not allowed to change the plugin code (which is understandable).

    How could we best adress this issue while we want to keep using the plugin?

    Awaiting your reply,
    Best regards,
    Nick

    • This topic was modified 3 years, 6 months ago by jicto. Reason: Extra info
    • This topic was modified 3 years, 6 months ago by jicto.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter jicto

    (@jicto)

    Here is the two photo’s we used.

    https://ibb.co/WgLB15z
    5568×11136 pixels
    https://ibb.co/BzRjjBS
    11658×6112 pixels

    Plugin Author pepe

    (@pputzer)

    What error error do you get with the those images? Do you get the same error when you upload them in the Media Library? Avatar Privacy uses _wp_handle_upload internally, so things should behave more or less the same. It is called with the $action parameter set to 'avatar_privacy_upload_default_icon' or one of the actions defined here, so in principle, you could add any pre-upload check you want. (Although it would probably be best to include some sanity checks in a future version of the plugin.)

    Thread Starter jicto

    (@jicto)

    Hi Pepe!

    Thank you for your response.

    Immediately after uploading we get a critical error (see screenshot), We also tried adding some code (https://wordpress.stackexchange.com/questions/130203/limit-image-resolution-on-upload) that limits the resolution for image uploads. This works for files uploaded directly via media library, but it doesn’t seem to work for the Avatar privacy’s (front-end) file uploader, we still get the critical error when uploading that file. ( https://ibb.co/vmtPM0S – A critical error has occurred on your site )

    Do you also get an error when trying to upload one of the two example photo’s?

    Kind regards,

    Plugin Author pepe

    (@pputzer)

    Yeah, that filter hook is actually {$action}_prefilter, that’s why I linked the various $action parameters above. For the plain frontend form, $action would be set to to avatar_privacy_frontend_upload_avatar, so avatar_privacy_frontend_upload_avatar_prefilter should work as expected.

    Plugin Author pepe

    (@pputzer)

    PS: While very slow, I was able to upload both images as user avatars on the frontend and on the backend in the Media Library on my local test setup (the error message probably comes from a lower PHP memory setting). However, it was not a good user experience. I think I’ll implement some pixel size limits in the future.

    Plugin Author pepe

    (@pputzer)

    @jicto Have you been able to make this work with the proper filter hook?

    Plugin Author pepe

    (@pputzer)

    I’ve added a feature request on GitHub. If necessary, we can continue the discussion there.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Maximum pixels for an upload’ is closed to new replies.