r84635 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84634‎ | r84635 | r84636 >
Date:21:42, 23 March 2011
Author:btongminh
Status:deferred
Tags:
Comment:
VipsHandler: Fix target width by offsetting the file dimensions per bug 25990#c7
Modified paths:
  • /trunk/extensions/VipsScaler/VipsScaler_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/VipsScaler/VipsScaler_body.php
@@ -48,13 +48,16 @@
4949 # Set the new rotated file
5050 $tmp = $tmp2;
5151 }
 52+
 53+ # Calculate shrink factors. Offsetting by 0.5 pixels is required
 54+ # because of rounding down of the target size by VIPS. See 25990#c7
5255 if ( $rotation % 180 == 90 ) {
5356 # Rotated 90 degrees, so width = height and vice versa
54 - $rx = $params['srcWidth'] / $params['physicalHeight'];
55 - $ry = $params['srcHeight'] / $params['physicalWidth'];
 57+ $rx = $params['srcWidth'] / ($params['physicalHeight'] + 0.5);
 58+ $ry = $params['srcHeight'] / ($params['physicalWidth'] + 0.5);
5659 } else {
57 - $rx = $params['srcWidth'] / $params['physicalWidth'];
58 - $ry = $params['srcHeight'] / $params['physicalHeight'];
 60+ $rx = $params['srcWidth'] / ($params['physicalWidth'] + 0.5);
 61+ $ry = $params['srcHeight'] / ($params['physicalHeight'] + 0.5);
5962 }
6063
6164 # Scale the image to the final output

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r84281(bug 25990) Add VIPS scaling. VIPS is a set of image manipulation tools speci...btongminh22:46, 18 March 2011

Status & tagging log