Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#37730 closed defect (bug) (invalid)

Maybe image crop function problem on 4.6 version please check on function

Reported by: hmbashar's profile hmbashar Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6
Component: Media Keywords: reporter-feedback
Focuses: Cc:


I have developed many theme and plugin and most of them are used WordPress image crop function and it was working normally. But when I updated WordPress version 4.6, The WordPress image crop function is not working correctly in many of my plugin and theme. Example: when i gave

add_image_size( 'cb_member_img', 300, 300 );

but when i upload images, then images are cropped as his wish, different times different sizes. I have uploaded 5/6 images, the images width are OK, But heights are different such as 241, 266, 214 etc. Here i uploaded images which are sized in width and height were 2000px/1500px.
I have used this code:

function cb_member_thum(){
 add_theme_support( 'post-thumbnails' );
 add_theme_support( 'post-thumbnails', array( 'cb-team-member' ) );  
 add_image_size( 'cb_member_img', 300, 300 );
add_action('after_setup_theme', 'cb_member_thum');

And calling function try:

$cb_members_img = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'cb_member_img' );



and get function.

I mention it again that it was working before, but after updating WordPress 4.6, it was not working.

I think, it may be a problem in WordPress 4.6 image crop function. Please check. If problem will be found, fix this then next version updated will be released.


Change History (4)

#1 follow-up: @dd32
7 years ago

  • Component changed from General to Media
  • Keywords reporter-feedback added

Hi @hmbashar and welcome to Trac,

Can you confirm that you're using this exact code, add_image_size( 'cb_member_img', 300, 300 ); and expecting that the generated images would be 300px wide and 300px tall no matter what image is uploaded?

By default add_image_size() will scale an image proportionally, so if you upload a 500x500px image it'll get scaled to 300x300px, but if you upload a 2000x1000px image it'll get scaled down to 300x150px.
The 4th parameter can be set to cause the image to be cropped to the exact dimensions specified, the developer reference includes documentation on that parameter and valid settings.

#2 in reply to: ↑ 1 @hmbashar
7 years ago

Replying to dd32:

Thanks for quick reply, I will check now.

Again Thanks and sorry for that wrong report.

#3 @Presskopp
7 years ago

  • Resolution set to invalid
  • Status changed from new to closed

#4 @netweb
7 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.