1
0
mirror of https://github.com/mosbth/cimage.git synced 2025-08-30 10:59:51 +02:00

Added option - no-upscale, nu - as resizing strategy to decline upscaling of smaller images. Fix #61.

This commit is contained in:
Mikael Roos
2014-12-15 15:41:51 +01:00
parent 61e0473f47
commit 90bfced741
4 changed files with 125 additions and 26 deletions

View File

@@ -529,6 +529,15 @@ verbose("convolve = " . print_r($convolve, 1));
/**
* no-upscale, nu - Do not upscale smaller image to larger dimension.
*/
$upscale = getDefined(array('no-upscale', 'nu'), false, true);
verbose("upscale = $upscale");
/**
* Display image if verbose mode
*/
@@ -565,6 +574,7 @@ $img->log("Incoming arguments: " . print_r(verbose(), 1))
'fillToFit' => $fillToFit,
'crop' => $crop,
'area' => $area,
'upscale' => $upscale,
// Pre-processing, before resizing is done
'scale' => $scale,

View File

@@ -0,0 +1,50 @@
<?php
// Include config for all testcases
include __DIR__ . "/config.php";
// The title of the test case
$title = "Testing option no-upscale";
// Provide a short description of the testcase.
$description = "Do not upscale image when original image (slice) is smaller than target image.";
// Use these images in the test
$images = array(
'car.png',
);
// For each image, apply these testcases
$nc = null; //"&nc"; //null; //&nc';
$testcase = array(
$nc . '&w=600',
$nc . '&w=600&no-upscale',
$nc . '&h=400',
$nc . '&h=400&no-upscale',
$nc . '&w=600&h=400',
$nc . '&w=600&h=400&no-upscale',
$nc . '&w=600&h=400&stretch',
$nc . '&w=600&h=400&no-upscale&stretch',
$nc . '&w=600&h=400&crop-to-fit',
$nc . '&w=600&h=400&no-upscale&crop-to-fit',
$nc . '&w=600&h=400&fill-to-fit',
$nc . '&w=600&h=400&no-upscale&fill-to-fit',
/*
$nc . '&w=600&ar=1.6',
$nc . '&w=600&ar=1.6&no-upscale',
$nc . '&h=400&ar=1.6',
$nc . '&h=400&ar=1.6&no-upscale',
*/
);
// Apply testcases and present results
include __DIR__ . "/template.php";