Divi WordPress Theme
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix WP_Customize_Cropped_Image_Control, flex_width, flex_height

Discussion in 'Misc WordPress Requests' started by WebTrooper, Nov 19, 2017.

  1. WebTrooper


    WP_Customize_Cropped_Image_Control, flex_width, flex_height, by WebTrooper

    I’m running into two issues with using flex_height and flex_width, which are probably related. In the following code I have both flex_width and flex_height set to false, which is also the default.

    $wp_customize->add_setting(‘cropped_image_1’, array(
    ‘type’ => ‘option’,
    ‘capability’ => ‘edit_theme_options’,
    ‘sanitize_callback’ => ‘absint’

    $wp_customize->add_control(new WP_Customize_Cropped_Image_Control($wp_customize,
    ‘bc_cropped_image_1’, array(
    ‘section’ => ‘cropped_images’,
    ‘label’ => ‘Image 1’,
    ‘width’ => 1280,
    ‘height’ => 420,
    ‘flex_width’ => false,
    ‘flex_height’ => false,

    Issue 1 – I’m still able to change the respective dimensions independently and non-proportionally.

    Issue 2 – When I change the proportions of the cropped image, the resulting image is distorted to fit the properly cropped dimensions.

    In short, if I adjust the crop handles to make a square, the resulting image will be “squished” to the proper size of 1280 x 420.

    This seems like a bug but it’s my first time using WP_Customize_Cropped_Image_Control, so figured I should ask here before submitting a bug report. Any ideas?


    WP_Customize_Cropped_Image_Control, flex_width, flex_height

Share This Page

Monarch Social Sharing Plugin