http://www.mediawiki.org/wiki/Special:Code/MediaWiki/84471

Revision: 84471
Author:   btongminh
Date:     2011-03-21 18:40:01 +0000 (Mon, 21 Mar 2011)
Log Message:
-----------
VipsHandler: Use im_shrink, which is PIO instead of WIO

Modified Paths:
--------------
    trunk/extensions/VipsScaler/VipsScaler_body.php

Modified: trunk/extensions/VipsScaler/VipsScaler_body.php
===================================================================
--- trunk/extensions/VipsScaler/VipsScaler_body.php     2011-03-21 18:38:45 UTC 
(rev 84470)
+++ trunk/extensions/VipsScaler/VipsScaler_body.php     2011-03-21 18:40:01 UTC 
(rev 84471)
@@ -48,10 +48,18 @@
                        # Set the new rotated file
                        $tmp = $tmp2;
                }
+               if ( $rotation % 180 == 90 ) {
+                       # Rotated 90 degrees, so width = height and vice versa
+                       $rx = $params['srcWidth'] / $params['physicalHeight'];
+                       $ry = $params['srcHeight'] / $params['physicalWidth'];
+               } else {
+                       $rx = $params['srcWidth'] / $params['physicalWidth'];
+                       $ry = $params['srcHeight'] / $params['physicalHeight'];
+               }
                
                # Scale the image to the final output
-               list( $err, $retval ) = self::vips( 'im_resize_linear', $tmp, 
-                       $params['dstPath'], $params['physicalWidth'], 
$params['physicalHeight'] );
+               list( $err, $retval ) = self::vips( 'im_shrink', $tmp, 
+                       $params['dstPath'], $rx, $ry );
                # Remove the temp file
                unlink( $tmp );
                if ( $retval != 0 ) {


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to