[wp-trac] [WordPress Trac] #18532: resized image dimensions incorrectly floored instead of rounded
WordPress Trac
noreply at wordpress.org
Thu Oct 2 13:50:12 UTC 2014
#18532: resized image dimensions incorrectly floored instead of rounded
-------------------------------------+-----------------------------
Reporter: _ck_ | Owner: SergeyBiryukov
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: 4.1
Component: Media | Version: 2.5
Severity: normal | Resolution:
Keywords: has-patch needs-refresh | Focuses:
-------------------------------------+-----------------------------
Comment (by kitchin):
Patch 18532k.diff does this:
1. Adjusts resize tests to match new behavior where it is off by one pixel
from old behavior. I forgot to make a test to fail the bug report, so we
need to do that still. The new numbers agree with IrfanView, Photoshop,
any web browser, etc., of course. Because they round. This shows we need
the patch.
2. Changes a bunch of `assertEquals()` to assertSame()` because the
function should continue to return integers, not floats that look like
integers.
3. I put the same rounding fix in image_resize_dimensions() for cropping.
4. I have some xxx comments that need to be resolved or deleted.
5. Getting scary looking console errors on my CentOS 5 system cPanel with
ImageMagick 6.2.8 (yum up to date), so I disabled the unit tests that try
to load a PNG or GIF when Worpdress decides ImageMagick only supports JPG
(iterator support). They try to load a WP_Error object back into
ImageMagick. Instead I did markTestSkipped() when
5a. WP_Error reached in PNG or GIF test.
5b. Any call to test_resize_bad_image() with ImageMagick is skipped.
We will probably want a patch without the (5b) change, or condition (5b)
on PNG support. There no need for the (5a) console errors at all, they
need to be either assertions or skips.
I kept the assert on ImageMagick PNG support in general, so you still get
one Fail. (That makes it skip the assert for GIF support.)
6. Existing code could use some style cleanup.
Proposed changes for next patch:
* Make a test this bug fails.
* Condition (5b) Skip on no ImageMagick PNG support.
* Fix xxx comments.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/18532#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list