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:
@@ -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,
|
||||
|
50
webroot/test/test_option-no-upscale.php
Normal file
50
webroot/test/test_option-no-upscale.php
Normal 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";
|
Reference in New Issue
Block a user