I’m using the following code to allow a user to upload a custom image (in addition to header image) through the customizer. Is there a way to crop the image when displaying it?
$wp_customize->add_setting( 'intro-img',
array (
'default' => 'http://example.com/image.png',
)
);
$wp_customize->add_control(
new WP_Customize_Image_Control(
$wp_customize,
'intro-img',
array(
'label' => 'Intro Image',
'section' => 'section_one',
'settings' => 'intro-img'
)
)
);
and displaying with:
<?php echo get_theme_mod( 'intro-img', 'http://example.com/image.png' ); ?>
With your method it would be very tricky, if it’s possible at all. What you could do is use a custom header with flexible dimensions. That would allow the user to upload the header image and then crop it how ever they needed easily.