WordPress.org

Forums

Image Widget
Ignoring medium_crop option (2 posts)

  1. drywallbmb
    Member
    Posted 2 years ago #

    Just installed this plugin. Seems to work great, except that it doesn't quite play nice with my theme.

    In my theme I run update_option('medium_crop', '1') so that my medium-sized images are always exactly 300 x 230.

    In this widget, in the media selector I can select my image, and choose the medium size. The widget populates with the correct height and width, and shows my nice 300x230 image.

    But as soon as I hit "Save" for the widget, this plugin appears to generate a new version of my image, at the medium size but without the crop set to 1 — so instead I get an image that measures 300 x 180 (whatever ratio is appropriate). I've confirmed by watching the filesystem that this new image file doesn't exist until I hit save on the widget itself.

    Any ideas how to prevent this behavior?

    http://wordpress.org/extend/plugins/image-widget/

  2. drywallbmb
    Member
    Posted 2 years ago #

    Okay, so I found the call on line 89 to image_resize(), and by adding a fourth argument I can force that to do a crop instead of a resize.

    It'd be better, though, to change the logic in get_image_url() to look for an existing file at the user-specified dimensions, and use that if it exists, rather than calling image_resize() whether or not the file in question already exists. Just my two cents, anyway.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Image Widget
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags