Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#26846 closed defect (bug) (worksforme)

add_image_size "favoring" height instead of generating specific dimensions...

Reported by: alturic's profile alturic Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.8
Component: Media Keywords:
Focuses: Cc:


Ok, so in 3.7 I had: add_image_size('art-slide-med', 700, 415, true); and everything seemed to work fine, as in it generated an image at 700x415 yet in 3.8 it SEEMS that if you set anything for height it completely bases the width of the image from that, regardless of cropping is true or false. Now, if I did 700, 0, true/false (doesn't matter) it uses the correct width and generates a random height of course.

So I'm fairly certain this is a bug with 3.8 unless something has changed with the way add_image_size works?

Change History (6)

#1 @markoheijnen
9 years ago

  • Keywords reporter-feedback added
  • Severity changed from critical to normal

Can you tell me a bit about the images you try to upload? In case the image is 700x300 it will never be cropped to 700x415 for example. Also do you have any plugins that could cause this issue?

I did reduce the severity since the code that does this has quite a few unit tests and the tests didn't break.

#2 @alturic
9 years ago

I'd dare say it's any size to be honest. As I said, it seems like if height is specified it completely ignores the width setting, but if height is 0 then it uses the width setting.

To directly answer your question though the three images I used were: 2200x1467, 1348x718 and 1440x900 and I tried it with and without plugins of course.

To elaborate a little further though, I tested this with a completely fresh 3.8 install using twentyfourteen and twentythirteen (obviously adding the add_image_size code) and still came up with the same problem. I then did a testbed install (to ensure it wasn't something I did with my theme) of 3.7.1 and using twentythirteen it made the correct dimensions specified as well as my theme made the correct dimensions specified (and that was with a complete copy of the same theme folder so that completely rules out the theme/theme incompatibility with 3.8.

Not harping on you for changing the severity (seriously) but unless something changed in 3.8 with the way it handles dimensions the code/dimensions generate perfectly on 3.7.1 so I'd say it is a critical bug potentially even a game-breaking bug for production sites. Even talking to some people in IRC made it seem like they knew about it and were holding off on upgrading because of it.

It's easily reproducible, just add my code: add_image_size('art-slide-med', 700, 415, true); to any of the default themes on 3.8 and you should see it makes the image something like (I believe this is the sizes it made) 694x435. If I changed my code to something like 700, 435 it would then make the image something like 709x4XX, regardless as I said for some reason it just seems like if height is specified in 3.8 it completely throws out the width setting.

#3 @alturic
9 years ago

  • Keywords reporter-feedback removed

#4 @alturic
9 years ago

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

Alright so... I did yet another fresh 3.8 install and everything appears to be working magically now. I have no idea why it wasn't working last night but so far everything seems to be working correctly.

#5 @markoheijnen
9 years ago

Great that it did worked out.

#6 @ocean90
9 years ago

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