• Resolved perflex

    (@perflex)


    [ Moderator note: removed text unrelated to plugin ] i start using this wonderful free plugin recently and i can tell it really does a good job * but i was trying so many ways to make it or force it to crop my uploaded images instead of only scale them or resize them i have a header slider to feed submitted users posts images size is (350×197) so when a user upload an image with an aspect ratio of 16:9 it gives the right size (350×197) but when i user upload an image with 4:3 the result is (263×197) * so plz if anyone of you know any trick to make imsanity crop the 4:3 images to make them exactly (350×197) ** tnx in advance *

    • This topic was modified 7 years, 11 months ago by bdbrown.
    • This topic was modified 7 years, 11 months ago by bdbrown.
Viewing 12 replies - 1 through 12 (of 12 total)
  • Perhaps plugin “simple image sizes” can help you…

    Thread Starter perflex

    (@perflex)

    hi mpek * i tried every single plugin on the wordpress library but none of them did the job only imsanity did * i need someone with good knowledge to show just how to add crop fucntion to imsanity or maybe a trick to make it crop my images or change max-width and max-height with my exact width and height ??

    Plugin Author nosilver4u

    (@nosilver4u)

    As you discovered @perflex, Imsanity only scales images, it is not capable of cropping them. That said, there is a parameter for cropping, but it is hardcoded to false currently. I’m adding the ability for a developer to override the crop parameter to the roadmap.
    If you want to do it in the meantime, look in libs/utils.php and set $crop = true on line 46 and that should do what you are looking for.

    Thread Starter perflex

    (@perflex)

    Hi there how r you * tnx for ur reply * but i’ve already tried it but no luck * i finally found a way to define my desired size using css code but i hope u can add this feature if u’r planning to update the plugin in the near future * tnx and good lucl my friend *

    Plugin Author nosilver4u

    (@nosilver4u)

    Ah, I found one more thing that needed to change. The function wp_constrain_dimensions() alters the dimensions to make them proportional. I’ve written in a way around that with the filter for the next version.

    Thread Starter perflex

    (@perflex)

    tnx for supporting imsanity * that’s good news my friend * i’m looking forward to the next version * have a lovely day * and mery christmas*

    I found this plugin extremely useful. Clients don’t have to think about resizing, cropping etc. This is where Imsanity came in! It really do the great job!

    @nosilver4u I hope you will add the ability to crop the images on the fly in future releases. This feature will make the plugin incredible! My special thanks to you and your team for the wonderful job you did!

    • This reply was modified 7 years, 9 months ago by almone.
    Plugin Author nosilver4u

    (@nosilver4u)

    You can enable cropping using the ‘imsanity_crop_image’ filter in the current version.
    See this for more information about filters: https://code.tutsplus.com/articles/the-beginners-guide-to-wordpress-actions-and-filters–wp-27373
    And this for how to implement them (with examples): https://ewww.io/2016/03/16/ewww-image-optimizer-filters-part-1/

    Oh, I missed this! Thanks for quick reply! ??

    Plugin Author nosilver4u

    (@nosilver4u)

    No worries, filters are kind of hidden, easy to miss!

    BTW I found a little bug: if I set JPEG quality >= 93 then plugin doesn’t work. Particularly ‘imsanity_crop_image’ filter doesn’t work as well.

    Plugin Author nosilver4u

    (@nosilver4u)

    @almone, was just thinking about this again. And I think it is probably because the images are too large (in filesize) at quality 93, and Imsanity will not save the image when the file size is larger than the original.

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘imsanity – how to unable crop or force it ???’ is closed to new replies.