Unicornisaurous has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/264435

Change subject: Add support for image interlacing to VipsScaler extension
......................................................................

Add support for image interlacing to VipsScaler extension

Bug: T120032
Change-Id: Iba5d39aa0735c1886ba64f1cc7e3b91d695ca1f2
Depends-On: I40dee74060026513f1c2be8c22dfe41a0b4a18df
---
M SpecialVipsTest.php
M VipsScaler_body.php
2 files changed, 17 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/VipsScaler 
refs/changes/35/264435/1

diff --git a/SpecialVipsTest.php b/SpecialVipsTest.php
index d7ee130..0e9e484 100644
--- a/SpecialVipsTest.php
+++ b/SpecialVipsTest.php
@@ -329,6 +329,7 @@
                                'srcPath' => $file->getLocalRefPath(),
                                'dstPath' => $dstPath,
                                'dstUrl' => $dstUrl,
+                               'interlace' => $request->getVal( 'interlace', 
false ),
                        );
 
                        $options = array();
diff --git a/VipsScaler_body.php b/VipsScaler_body.php
index fc7fd27..5b90dae 100644
--- a/VipsScaler_body.php
+++ b/VipsScaler_body.php
@@ -215,6 +215,18 @@
                if ( $rotation % 360 != 0 && $rotation % 90 == 0 ) {
                        $commands[] = new VipsCommand( $wgVipsCommand, array( 
"im_rot{$rotation}" ) );
                }
+
+               // Interlace
+               if ( $params['interlace'] ) {
+                       list( $major, $minor ) = File::splitMime( 
$file->getMimeType() );
+                       if ( $major == 'image' && in_array( $minor, array( 
'jpeg', 'png' ) ) ) {
+                               $commands[] = new VipsCommand( $wgVipsCommand, 
array( "im_vips2{$minor}" ));
+                       } else {
+                               // File type unsupported for interlacing, 
return empty array to cancel processing
+                               return array();
+                       }
+               }
+
                return $commands;
        }
 
@@ -427,6 +439,10 @@
                } else {
                        $this->output = $output;
                }
+               // Add interlace option if its an interlace command
+               if ( preg_match( '/^im_vips2/', $this->args[0] ) ) {
+                       $this->output .= ":,1";
+               }
        }
 
        /**

-- 
To view, visit https://gerrit.wikimedia.org/r/264435
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iba5d39aa0735c1886ba64f1cc7e3b91d695ca1f2
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VipsScaler
Gerrit-Branch: master
Gerrit-Owner: Unicornisaurous <[email protected]>

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

Reply via email to