r67719 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r67718‎ | r67719 | r67720 >
Date:13:59, 9 June 2010
Author:daniel
Status:deferred
Tags:
Comment:
fix handling of lossy/lossless modifier in makeParamString
Modified paths:
  • /trunk/extensions/PagedTiffHandler/PagedTiffHandler_body.php (modified) (history)
  • /trunk/extensions/PagedTiffHandler/tests/PagedTiffHandlerTest.php (modified) (history)

Diff [purge]

Index: trunk/extensions/PagedTiffHandler/tests/PagedTiffHandlerTest.php
@@ -97,7 +97,7 @@
9898 $this->handler->normaliseParams($this->image, $params );
9999 $this->assertEquals($params['height'], 75);
100100 // makeParamString
101 - $this->assertEquals($this->handler->makeParamString(array('width'=>'100', 'page'=>'4')), "lossless-page4-100px");
 101+ $this->assertEquals($this->handler->makeParamString(array('width'=>'100', 'page'=>'4', 'lossy'=>'lossless')), "lossless-page4-100px");
102102
103103 // ---- File upload checks and Thumbnail transformation
104104 // check
Index: trunk/extensions/PagedTiffHandler/PagedTiffHandler_body.php
@@ -156,7 +156,13 @@
157157 if ( !isset( $params['width'] ) ) {
158158 return false;
159159 }
160 - $lossy = isset( $params['lossy'] ) && $params['lossy'] ? 'lossy' : 'lossless';
 160+
 161+ if ( !isset( $params['lossy'] ) || in_array( $params['lossy'], array( 1, '1', 'true', 'lossy' ) ) ) {
 162+ $lossy = 'lossy';
 163+ } else {
 164+ $lossy = 'lossless';
 165+ }
 166+
161167 return "{$lossy}-page{$page}-{$params['width']}px";
162168 }
163169

Status & tagging log