Support » Plugins and Hacks » [Resolved] How to use a resized but not cropped version of event image

[Resolved] How to use a resized but not cropped version of event image

  • We now use placeholders like “#_EVENTIMAGE” or “#_EVENTIMAGE{400,400}” to display event images. The first one loads the image in full, and while it’s possible to alter the visibility with CSS and HTML, the client’s browser always loads every megabyte of the full image. The second one uses TimThumb to resize and crop the image to the specified size.

    How to show a resized image preserving the original aspect ratio (is not cropped)? The specified dimensions would thus be maximum dimensions. For example “#_EVENTIMAGE{400,400,nocrop}” that would show a 1000×500 as a 400×200 image.

    Doesn’t TimThumb support a parameter “zc=0” for not cropping the image, only resizing it? http://www.binarymoon.co.uk/demo/timthumb-zoom-crop/ If not, is there a custom shortcode example available for this that we could use?


Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Marcus


    NetWebLogic Support

    something we could consider int he future but atm you can now allow WP to do that for you by using the new WP thumbnails option under Settings > General > Performance Optimization

    On our site we would want certain images to be cropped and certain images to not be cropped. We would prefer that this would be done via WP thumbnails for performance, but as long as both can be used at the same time, we don’t mind if either or both are done via TimThumb.

    Would it be possible for you to add support for “nocrop” and “crop” parameters for #_EVENTIMAGE?

    Plugin Author Marcus


    NetWebLogic Support

    yes, but probably not anytime soon, we’ve already got a lot to work through atm

    @daedalon: if you want a bit more control, register a custom image size (with / without crop) and hack this snippet to use that custom image size instead of thumbnail.

    Plugin Author Marcus


    NetWebLogic Support

    @webaware, nice snippet!

    Thanks, webaware! Looks excellent, will try that.

    I got it working after a few adjustments.

    1. Instead of a full copy-paste, I copied only the most central part of the snippet and used it inside the switch-case structure for custom placeholders as per http://wp-events-plugin.com/tutorials/create-a-custom-placeholder-for-event-formatting/.

    For that to work I had to change “$result” to “$replace”.

    2. Thumbnails had to be regenerated for the new custom image size before an already-added event’s image started displaying properly. I used the excellent Simple Image Sizes plugin. This plugin can also be used to create the custom image size without having to touch the theme’s functions.php file.

    Before regenerating the thumbnails the default full-size image was loaded and then resized in the browser.

    Thanks again for the help, webaware!

    @daedalon: excellent, good work. I love it when a plan comes together 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Resolved] How to use a resized but not cropped version of event image’ is closed to new replies.