PHP Classes

File: test/cropAndResizeTest.php

Recommend this page to a friend!
  Classes of Kjell-Inge Gustafsson   PHP Image Handling API   test/cropAndResizeTest.php   Download  
File: test/cropAndResizeTest.php
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: PHP Image Handling API
Provide an API to do image manipulation operations
Author: By
Last change:
Date: 2 years ago
Size: 12,705 bytes
 

Contents

Class file image Download
<?php /** * cropAndResizeTest.php * * @package imageHandler * @subpackage test * @copyright 2015, Kjell-Inge Gustafsson kigkonsult, All rights reserved * @author Kjell-Inge Gustafsson, kigkonsult <ical@kigkonsult.se> * @link http=>//kigkonsult.se/imageHandler/index.php * @license non-commercial use: Creative Commons * Attribution-NonCommercial-NoDerivatives 4.0 International License * (http://creativecommons.org/licenses/by-nc-nd/4.0/) * commercial use :imageHandler141license / imageHandler14Xlicense * @version 1.4 */ $testcases = array( 0 => array( 'input' => 'none', // don't alter this test step! 'result' => 'as is...', 'cx' => '', // crop center x coordinate, from left border (0%), to right border (100%), default 50% 'cy' => '', // crop center y coordinate, from top border (0%), to bottom border (100%), default 50% 'cw' => '', // crop width, percent or pixels 'ch' => '', // crop height, percent or pixels 'w' => '', // width, percent (of original image width) or pixels 'h' => '', // height, percent or pixels 'mw' => '', // box max width, percent or pixels, overrides width and height 'mh' => '', // box max height, percent or pixels, overrides width and height ), 1 => array( 'input' => 'maxwidth = 50, maxheight = 50', 'result' => 'prop. resize in a 50x50 thumbnail', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '', 'w' => '', 'h' => '', 'mw' => 50, 'mh' => 50, ), 2 => array( 'input' => 'width -= 20%', 'result' => 'prop. downsize to 80% width', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '', 'w' => '80%', 'h' => '', 'mw' => '', 'mh' => '', ), 3 => array( 'input' => 'width += 20%', 'result' => 'prop. upsize to 120% width', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '', 'w' => '120%', 'h' => '', 'mw' => '', 'mh' => '', ), 4 => array( 'input' => 'height -= 20%', 'result' => 'prop. downsize to 80% height', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '', 'w' => '', 'h' => '80%', 'mw' => '', 'mh' => '', ), 5 => array( 'input' => 'height += 20%', 'result' => 'prop. upsize to 120% height', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '', 'w' => '', 'h' => '120%', 'mw' => '', 'mh' => '', ), 6 => array( 'input' => 'width = 80%, heighth = 80%', 'result' => 'prop. downsize to 80%', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '', 'w' => '80%', 'h' => '80%', 'mw' => '', 'mh' => '', ), 7 => array( 'input' => 'width = 80%, height = 120%', 'result' => 'distorted resize with 80% width, 120% height', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '', 'w' => '80%', 'h' => '120%', 'mw' => '', 'mh' => '', ), 8 => array( 'input' => 'width = 120%, height = 80%', 'result' => 'distorted resize with 120% width, 80% height', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '', 'w' => '120%', 'h' => '80%', 'mw' => '', 'mh' => '', ), 9 => array( 'input' => 'width = 120%, height = 120%', 'result' => 'prop. upsize to 120%', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '', 'w' => '120%', 'h' => '120%', 'mw' => '', 'mh' => '', ), 10 => array( 'input' => 'maxwidh = 300', 'result' => 'prop. resize to fit in box with 300 width', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '', 'w' => '', 'h' => '', 'mw' => '300', 'mh' => '', ), 11 => array( 'input' => 'maxheight = 300', 'result' => 'prop. resize to fit in box with 300 height', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '', 'w' => '', 'h' => '', 'mw' => '', 'mh' => '300', ), 12 => array( 'input' => 'width = 120%, maxwidth = 80%', 'result' => 'prop. resize to fit in box with 80% width', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '', 'w' => '120%', 'h' => '', 'mw' => '80%', 'mh' => '', ), 13 => array( 'input' => 'width = 90%, maxheight = 70%', 'result' => 'prop. resize to fit in box with 70% height', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '', 'w' => '90%', 'h' => '', 'mw' => '', 'mh' => '70%', ), 14 => array( 'input' => 'height = 90%, maxwidth = 70%', 'result' => 'prop. resize to fit in box with 70% width', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '', 'w' => '', 'h' => '90%', 'mw' => '70%', 'mh' => '', ), 15 => array( 'input' => 'height = 90%, maxheight = 70%', 'result' => 'prop. resize to fit in box with 70% height', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '', 'w' => '', 'h' => '90%', 'mw' => '', 'mh' => '70%', ), 16 => array( 'input' => 'maxwidth = 70%, maxheight = 70%', 'result' => 'prop. resize to fit in box with 70% width/height', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '', 'w' => '', 'h' => '', 'mw' => '70%', 'mh' => '70%', ), 17 => array( 'input' => 'width = 120%, maxwidth = 70%, maxheight = 70%', 'result' => 'prop. resize to fit in box with 70% width/height', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '', 'w' => '120%', 'h' => '', 'mw' => '70%', 'mh' => '70%', ), 18 => array( 'input' => 'height = 120%, maxwidth = 70%, maxheight = 70%', 'result' => 'prop. resize to fit in box with 70% width/height', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '', 'w' => '', 'h' => '120%', 'mw' => '70%', 'mh' => '70%', ), 19 => array( 'input' => 'maxwidth = 200%, maxheight = 200%', 'result' => 'prop. resize to fit in box with 200% width/height', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '', 'w' => '', 'h' => '', 'mw' => '200%', 'mh' => '200%', ), 20 => array( 'input' => 'crop, width = 50%, height = 50%', 'result' => 'centered crop, 50%', 'cx' => '', 'cy' => '', 'cw' => '50%', 'ch' => '50%', 'w' => '', 'h' => '', 'mw' => '', 'mh' => '', ), 21 => array( 'input' => 'crop width = 100, height = 100', 'result' => 'centered crop, 100x100', 'cx' => '', 'cy' => '', 'cw' => '100', 'ch' => '100', 'w' => '', 'h' => '', 'mw' => '', 'mh' => '', ), 22 => array( 'input' => 'crop 75%x75%, maxwidth = 200, maxheight = 200', 'result' => 'centered crop, 75%, then fit in 200x200 box', 'cx' => '', 'cy' => '', 'cw' => '75%', 'ch' => '75%', 'w' => '', 'h' => '', 'mw' => '200', 'mh' => '200', ), 23 => array( 'input' => 'crop 25%x100%, maxwidth = 100, maxheight = 350', 'result' => 'vertical centered slice 25% width, then fit in 100x350 box', 'cx' => '', 'cy' => '', 'cw' => '25%', 'ch' => '', 'w' => '', 'h' => '', 'mw' => '100', 'mh' => '350', ), 24 => array( 'input' => 'crop 100%x25%, maxwidth = 350, maxheight = 100', 'result' => 'horizontal centered slice, 25% height, then fit in 350x100 box', 'cx' => '', 'cy' => '', 'cw' => '', 'ch' => '25%', 'w' => '', 'h' => '', 'mw' => '350', 'mh' => '100', ), 25 => array( 'input' => 'crop upper left 25%x25%, maxwidth = 350, maxheight = 100', 'result' => 'upper left 25%x25% region, then fit in 350x100 box', 'cx' => '0', 'cy' => '0', 'cw' => '25%', 'ch' => '25%', 'w' => '', 'h' => '', 'mw' => '350', 'mh' => '100', ), 26 => array( 'input' => 'crop middle left 25%x25%, maxwidth = 350, maxheight = 100', 'result' => 'middle left 25%x25% region, then fit in 350x100 box', 'cx' => '0', 'cy' => '33%', 'cw' => '25%', 'ch' => '25%', 'w' => '', 'h' => '', 'mw' => '350', 'mh' => '100', ), 27 => array( 'input' => 'crop lower right 25%x25%, maxwidth = 350, maxheight = 100', 'result' => 'lower right 25%x25% region, then fit in 250x150 box', 'cx' => '75%', 'cy' => '75%', 'cw' => '25%', 'ch' => '25%', 'w' => '', 'h' => '', 'mw' => '250', 'mh' => '150', ), 28 => array( 'input' => 'crop upper right 25%x25%, width = 350, height = 100', 'result' => 'upper right 25%x25% region, then resize to 350x200', 'cx' => '75%', 'cy' => '0', 'cw' => '25%', 'ch' => '25%', 'w' => '350', 'h' => '200', 'mw' => '', 'mh' => '', ), );