Generated media have incorrect aspect ratio

Uploaded an image via standard ‘add new’ dialog to the WordPress Media library. Here were the original Media Settings: Thumbnail – 150×150 Medium – 300×300 Large – 1024×1024 I uploaded a 650×144 image. Resulting generated image sizes: 150×144.jpg 300×66.jpg 336×144.jpg Only the medium image has the correct ratio. The other two images are basically a … Read more

Crop image from get_theme_mod Customizer field

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’, … Read more

Cropped thumbnail still displaying as full image

Steps to reproduce… 1) Add to functions.php: add_image_size( ‘half-size’, 200, 200, false ); 2) Add to template file (inside loop): <a href=”https://wordpress.stackexchange.com/questions/26740/<?php the_permalink(); ?>” title=”<?php the_title_attribute(); ?>” > <?php the_post_thumbnail (‘half-size’, array(‘class’ => ‘profile_image’)); ?> </a> 3) Go to media library and add image to post gallery. Then crop image, click “thumbnail” radio button and … Read more

How to crop image from center using wp_image_editor

I am working on WordPress plugin. In plugin the user upload images from meta field and in back end i use wp_image_editor for cropping and re sizing the images. The images re sized very well but on cropping the images not cropped very well. I give x-dimension 100 and y-dimension 0. $resize_img = wp_get_image_editor( $wpc_prod_img[‘wpc_resize_img’] … Read more

Use get/the_post_thumbnail with Custom Size & Crop

We know that the_post_thumbnail() outputs the thumbnail & that the_post_thumbnail( array(100,100) ) outputs the thumbnail at a specified size. And we know that we can use add_image_size( ‘category-thumb’, 300, 9999, $crop ); to add a custom image size which we can call using the_post_thumbnail(‘category-thumb’) with scaling and cropping applied. Is there a way to use … Read more

Add_image_size not cropping

I want to make a crop on the images of my blog page that have more than 443px adjust it to 645×443 size, exactly. I used this code: add_theme_support (‘post-thumbnails’); add_image_size (‘blog-page’, 645, 445, true); However, the image is resized instead of making the crop. Exemples: Original image: http://img843.imageshack.us/img843/6444/56004879.jpg How is: http://imageshack.us/scaled/landing/809/53926495.png How i want: … Read more

Why can’t I edit certain images from the WordPress Media library?

I’ve noticed some bizarre behaviour in my WordPress installation. For some photos, when I click “Edit Image”, the full image is not displayed to me – just the area visible in the thumbnail. And yet, if you click “View Image”, you can see the full image is actually there. Clearly, some manual intervention is required … Read more