Brian Wolff has uploaded a new change for review.

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


Change subject: [WIP] Add support for page numbers to VipsScaler.
......................................................................

[WIP] Add support for page numbers to VipsScaler.

Needed by I1b9a77a. Note at the moment, it seems like specifying a
page number doesn't work with shrink, so it needs to use im_shrink,
or specify the preconvert option. In my testing, tiff files seem
to also segfault for non-integer resizes when using shrink
(but not im_shrink or preconvert).

Not sure if the segfaulting is possibly something wrong with my
local copy of vips, or a general vips problem.

Bug: 52045
Change-Id: I2a493ece57601dc613681f67f110a2e7b99c4982
---
M VipsScaler_body.php
1 file changed, 8 insertions(+), 2 deletions(-)


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

diff --git a/VipsScaler_body.php b/VipsScaler_body.php
index 4dd8089..7f7cfcd 100644
--- a/VipsScaler_body.php
+++ b/VipsScaler_body.php
@@ -70,15 +70,21 @@
                        return true;
                }
 
+               $actualSrcPath = $params['srcPath'];
+               if ( isset( $params['page'] ) && $params['page'] > 1 ) {
+                       // This might not work correctly with shrink, but may
+                       // need im_shrink or preconvert option specified.
+                       $actualSrcPath .= ':' . (intval( $params['page'] ) - 1);
+               }
                # Execute the commands
                foreach ( $vipsCommands as $i => $command ) {
                        # Set input/output files
                        if ( $i == 0 && count( $vipsCommands ) == 1 ) {
                                # Single command, so output directly to dstPath
-                               $command->setIO( $params['srcPath'], 
$params['dstPath'] );
+                               $command->setIO( $actualSrcPath, 
$params['dstPath'] );
                        } elseif ( $i == 0 ) {
                                # First command, input from srcPath, output to 
temp
-                               $command->setIO( $params['srcPath'], 'v', 
VipsCommand::TEMP_OUTPUT );
+                               $command->setIO( $actualSrcPath, 'v', 
VipsCommand::TEMP_OUTPUT );
                        } elseif ( $i + 1 == count( $vipsCommands ) ) {
                                # Last command, output to dstPath
                                $command->setIO( $vipsCommands[$i - 1], 
$params['dstPath'] );

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2a493ece57601dc613681f67f110a2e7b99c4982
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/VipsScaler
Gerrit-Branch: master
Gerrit-Owner: Brian Wolff <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to