'h' => 'height',
'x' => 'x',
'y' => 'y',
- 'rotate' => 'rotate'
+ 'rot' => 'rotate'
);
// Paths to command-line tools
$unzipCmd = $this->getUnarchiveCommand($zipPath, $file);
$decompressCmd = $this->getDecompressCmd($imageInfo, $powReduce, $rotate, $scale, $region, $stdoutLink);
-
+
// Non-integer scaling is currently disabled on the cluster
// if (isset($_REQUEST['height'])) {
// $cmd .= " | pnmscale -height {$_REQUEST['height']} ";
$regionString = sprintf('[%dx%d+%d+%d]', $region['w'], $region['h'], $region['x'], $region['y']);
// The argument to ImageMagick's scale command is a "geometry". We pass in the new width/height
- $scaleString = sprintf("%dx%d", $region['w'] / $scale, $region['h'] / $scale);
+ $scaleString = ' -scale ' . sprintf("%dx%d", $region['w'] / $scale, $region['h'] / $scale);
+
+ $rotateString = '';
+ if ($rotate && $rotate != '0') {
+ $rotateString = ' -rotate ' . $rotate; // was previously checked to be a known value
+ }
- $decompressCmd = ' | convert -' . $regionString . ' -scale ' . $scaleString . ' pnm:-';
+ $decompressCmd = ' | convert -' . $regionString . $scaleString . $rotateString . ' pnm:-';
break;
default:
.attr('src', pageURI);
});
-asyncTest('Load image region from tiff - archive.org/download/fightingflyingc00rickgoog/page/n17_x1944_y1708_w668_h584.jpg', function() {
+asyncTest('Load image region from tiff, via br.getRegionURI - fightingflyingc00rickgoog - n17_x1944_y1708_w668_h584', function() {
$.getScript( jsLocateURL('fightingflyingc00rickgoog'), function() {
});
});
+
+asyncTest('Same image rotated 90 degrees, br.getRegionURI - fightingflyingc00rickgoog - n17_x1944_y1708_w668_h584_rot90', function() {
+
+ $.getScript( jsLocateURL('fightingflyingc00rickgoog'), function() {
+
+ expect(3);
+ var pageURI = br.getRegionURI(17, undefined, 90, 1944, 1708, 668, 584);
+
+ var img = new Image();
+ $(img).bind( 'load error', function(eventObj) {
+ equals(eventObj.type, 'load', 'Load image (' + pageURI + '). Event handler called');
+ equals(this.width, 584, 'Image width');
+ equals(this.height, 668, 'Image height');
+ start();
+ })
+ .attr('src', pageURI);
+
+ });
+});
+