Support » Plugin: Imsanity » Width or Height exceeds limit

  • Resolved joshpaynedesigns

    (@joshpaynedesigns)


    I am getting an error on a few of my WP Engine hosted site’s that use imsanity. I have spoke to WPE and they do not have image upload/resize restrictions anymore. It does seem to work on some of my site’s with PHP 7.3 and the 2.7.1 plugin but never on site’s with PHP 7.4. Also this happens with any larger size image wether it’s high res or low. The image in this error for ex. is 6880 × 4584 72dpi.

    “Imsanity was unable to resize this image for the following reason: width or height exceeds limit `/nas/content/live/lyhpd/wp-content/uploads/2021/03/DSC_3290.jpg’ @ error/cache.c/OpenPixelCache/3839. If you continue to see this error message, you may need to install missing server components. If you think you have discovered a bug, please report it on the Imsanity support forum: https://wordpress.org/support/plugin/imsanity”

    The page I need help with: [log in to see the link]

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Author nosilver4u

    (@nosilver4u)

    That message means there IS a limit, and it’s not from Imsanity. The only folks who can fix that are your host (WP Engine). The fact that it works on some sites with PHP 7.3 and not on 7.4 means those sites have different PHP configurations, and that can only be changed by WP Engine.

    Thread Starter joshpaynedesigns

    (@joshpaynedesigns)

    So why would it work every time on this base site with the same PHP and settings? https://acbase.wpengine.com/

    Thread Starter joshpaynedesigns

    (@joshpaynedesigns)

    I will chat with WPE again and see if there is something more on their end that they can do.

    Side note does the Big Image enhancement in WP 5.3 elimiate the need for Imsanity or is this just a helper incase you can’t have the plugin installed?

    “Until now it was possible to use the originally uploaded images on the front-end even when they are were not “web ready”. In WordPress 5.3 when a large image is uploaded it is stored in the uploads directory but is not used on the web site. A new scaled down image is created and used as the largest available size. This scaled down image is usually much more suitable for web use, the file size is up to ten times smaller than the original. See #47873.

    Additional changes:

    Introduces wp_get_original_image_path() that retrieves the path to the originally uploaded image in all cases.
    Introduces big_image_size_threshold filter to set the pixel value above which images will be scaled. The same value is used as max-width and max-height when scaling the original.”

    Plugin Author nosilver4u

    (@nosilver4u)

    Just because it uses the same PHP version doesn’t mean the site has the same PHP settings as another site. While they should be similar, it’s very possible for there to be anomalies with such things if one site was deployed a year ago (or five) and one was deployed just today.
    The only folks who can answer that question definitively are the ones at WPE.

    Plugin Author nosilver4u

    (@nosilver4u)

    And just got your follow-up as I was posting my reply 🙂

    The benefit to using Imsanity is that it does not keep the over-sized original on disk. WP 5.3+ saves the original version alongside the resized version.
    Additionally, it’s likely that the scaling in core WP will fail for the same reason as Imsanity (except it might not throw an error), since we’re just using the core WP resizing functions.

    Thread Starter joshpaynedesigns

    (@joshpaynedesigns)

    Interestingly enough the WP 5.3+ is resizing with no issues or errors. I do agree that keeping the oversized image is not great.

    https://lyhpd.wpengine.com/wp-content/uploads/2021/03/DSC_3290-scaled.jpg

    Plugin Author nosilver4u

    (@nosilver4u)

    And that’s on a site where Imsanity is not working for the same image?
    If so, that’s just nuts… we’re using the same exact code!

    Shortened slightly, but the important bits from core WP:

    $editor = wp_get_image_editor( $file );
    $resized = $editor->resize( $threshold, $threshold );
    $saved = $editor->save( $editor->generate_filename( 'scaled' ) );

    vs. Imsanity

    $editor = wp_get_image_editor( $file );
    $resized = $editor->resize( $max_w, $max_h, $crop );
    $dest_file = $editor->generate_filename( $suffix, $dest_path );
    $saved = $editor->save( $dest_file );
    Thread Starter joshpaynedesigns

    (@joshpaynedesigns)

    Ya the exact site with just Imsanity turned off. I’m sooo confused. I will let WPE know and see what they say as well.

    Plugin Author nosilver4u

    (@nosilver4u)

    FYI, I host with WPE too, and I have some inside contacts who I’m going to bug until I get answers on this 🙂

    Thread Starter joshpaynedesigns

    (@joshpaynedesigns)

    Just wanted to let you know that WP Engine has been doing more digging and testing and this is what they have found. Doesn’t really make sense but let me know what you think.

    Just wanted to update you on the issue you have with Imsanity plugin.
    
    I have been looking into this and I think I have found the issue causing errors on large images
    
    I have tested that plugin on my own default WordPress install and different configuration and got the same issue when uploading images:
    
    WP 5.7 and PHP 7.4 
    WP 5.7 and PHP 7.3
    WP 5.2.4 and PHP 7.4 
    WP 5.2.4 and PHP 7.3
    None of them worked, I have also tested doing the same on staging you have created staginglpd and got the same results. This caused me to believe that it was not issue with PHP nor WordPress version but plugin itself.
    
    However it seems that this plugins works on acbase so I have taken a closer look at that and its other plugins, I noticed there were one plugin active there related to images that was not on staginglpd called Force Regenerate Thumbnails. Once I have installed and activated it on staginglpd I was able to upload larger images without any issue.
    
    It seems to me like Imsanity has some kind of dependancy on Force Regenerate Thumbnails for it to work correctly, but that is just my theory, when it comes to third party plugins our expertise is limited, so I cant say exactly why that solved the issue.
    Plugin Author nosilver4u

    (@nosilver4u)

    That is very bizarre! I just tested it on my staging site at WPE and it worked also…
    To my knowledge, there is no linkage between Imsanity and Force Regenerate Thumbnails, but I’m going to investigate further and see how/why that worked.

    Thread Starter joshpaynedesigns

    (@joshpaynedesigns)

    You’re saying that it worked only when you added the Force Regenerate Thumbnails plugin?

    Plugin Author nosilver4u

    (@nosilver4u)

    Yup, it sure does, and I just found out why!
    When you install FRT, it changes the default image editor class to GD instead of Imagick.
    Since that error, and the resource limits, are from Imagick, swapping to GD bypasses the limit altogether.
    Now, I want to note that switching to GD means lower quality images, and will probably also increase the file size.

    The strange thing here, is that now I can’t get the error even with FRT disabled. I’ve confirmed WP_Image_Editor_Imagick is back to being the default, but now the limits seem to have vanished!

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘Width or Height exceeds limit’ is closed to new replies.