mirror of
https://github.com/mosbth/cimage.git
synced 2025-01-29 09:47:37 +01:00
adding testcases for #36
This commit is contained in:
parent
63112f58b1
commit
8523ef5e31
11
CImage.php
11
CImage.php
@ -167,6 +167,13 @@ class CImage
|
||||
private $newHeightOrig; // Save original value
|
||||
|
||||
|
||||
/**
|
||||
* Array with details on how to crop, incoming as argument and calculated.
|
||||
*/
|
||||
public $crop;
|
||||
public $cropOrig; // Save original value
|
||||
|
||||
|
||||
/**
|
||||
* Properties (clean up these)
|
||||
*/
|
||||
@ -174,7 +181,6 @@ class CImage
|
||||
|
||||
public $keepRatio;
|
||||
public $cropToFit;
|
||||
public $crop;
|
||||
|
||||
private $cropWidth;
|
||||
private $cropHeight;
|
||||
@ -388,8 +394,10 @@ class CImage
|
||||
$this->{$key} = $args[$key];
|
||||
}
|
||||
|
||||
// Save original values to enable re-calculating
|
||||
$this->newWidthOrig = $this->newWidth;
|
||||
$this->newHeightOrig = $this->newHeight;
|
||||
$this->cropOrig = $this->crop;
|
||||
|
||||
return $this;
|
||||
}
|
||||
@ -642,6 +650,7 @@ class CImage
|
||||
|
||||
$this->newWidth = $this->newWidthOrig;
|
||||
$this->newHeight = $this->newHeightOrig;
|
||||
$this->crop = $this->cropOrig;
|
||||
|
||||
$this->initDimensions()
|
||||
->calculateNewWidthAndHeight();
|
||||
|
@ -1,13 +1,13 @@
|
||||
<!doctype html>
|
||||
<head>
|
||||
<meta charset='utf-8'/>
|
||||
<title>Testing img for issue 36</title>
|
||||
<title>Testing img for issue 36 - autoRotate</title>
|
||||
<style>
|
||||
body {background-color: #ccc;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Testing issue 36</h1>
|
||||
<h1>Testing issue 36 - autoRotate</h1>
|
||||
|
||||
<?php
|
||||
error_reporting(-1); // Report all type of errors
|
76
webroot/test_issue36_rb-ra-180.php
Normal file
76
webroot/test_issue36_rb-ra-180.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
$angle = 180;
|
||||
?><!doctype html>
|
||||
<head>
|
||||
<meta charset='utf-8'/>
|
||||
<title>Testing img for issue 36 - rotateBefore, rotateAfter <?=$angle?></title>
|
||||
<style>
|
||||
body {background-color: #ccc;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Testing issue 36 - rotateBefore, rotateAfter <?=$angle?></h1>
|
||||
|
||||
<?php
|
||||
error_reporting(-1); // Report all type of errors
|
||||
ini_set('display_errors', 1); // Display all errors
|
||||
ini_set('output_buffering', 0); // Do not buffer outputs, write directly
|
||||
|
||||
$imgphp = "img.php?src=";
|
||||
|
||||
$images = array(
|
||||
'kodim08.png',
|
||||
'kodim04.png',
|
||||
);
|
||||
|
||||
$testcase = array(
|
||||
"&rb=$angle&nc",
|
||||
"&rb=$angle&nc&w=200",
|
||||
"&rb=$angle&nc&h=200",
|
||||
"&rb=$angle&nc&w=200&h=200&cf",
|
||||
"&ra=$angle&nc",
|
||||
"&ra=$angle&nc&w=200",
|
||||
"&ra=$angle&nc&h=200",
|
||||
"&ra=$angle&nc&w=200&h=200&cf",
|
||||
);
|
||||
?>
|
||||
|
||||
|
||||
<h2>Images used in test</h2>
|
||||
|
||||
<p>The following images are used for this test.</p>
|
||||
|
||||
<?php foreach($images as $image) : ?>
|
||||
<p><code><a href="img/<?=$image?>"><?=$image?></a></code><br>
|
||||
<img src="<?=$imgphp . $image?>"></p>
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
||||
<h2>Testcases used for each image</h2>
|
||||
|
||||
<p>The following testcases are used for each image.</p>
|
||||
|
||||
<?php foreach($testcase as $tc) : ?>
|
||||
<code><?=$tc?></code><br>
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
||||
<h2>Applying testcase for each image</h2>
|
||||
|
||||
<?php foreach($images as $image) : ?>
|
||||
<h3><?=$image?></h3>
|
||||
|
||||
<p><code><a href="img/<?=$image?>"><?=$image?></a></code><br>
|
||||
<img src="<?=$imgphp . $image?>"></p>
|
||||
|
||||
<?php foreach($testcase as $tc) : ?>
|
||||
<h4><?=$tc?></h4>
|
||||
|
||||
<p><code><a href="<?=$imgphp . $image . $tc?>"><?=$image . $tc?></a></code><br>
|
||||
<img src="<?=$imgphp . $image . $tc?>"></p>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
|
76
webroot/test_issue36_rb-ra-270.php
Normal file
76
webroot/test_issue36_rb-ra-270.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
$angle = 270;
|
||||
?><!doctype html>
|
||||
<head>
|
||||
<meta charset='utf-8'/>
|
||||
<title>Testing img for issue 36 - rotateBefore, rotateAfter <?=$angle?></title>
|
||||
<style>
|
||||
body {background-color: #ccc;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Testing issue 36 - rotateBefore, rotateAfter <?=$angle?></h1>
|
||||
|
||||
<?php
|
||||
error_reporting(-1); // Report all type of errors
|
||||
ini_set('display_errors', 1); // Display all errors
|
||||
ini_set('output_buffering', 0); // Do not buffer outputs, write directly
|
||||
|
||||
$imgphp = "img.php?src=";
|
||||
|
||||
$images = array(
|
||||
'kodim08.png',
|
||||
'kodim04.png',
|
||||
);
|
||||
|
||||
$testcase = array(
|
||||
"&rb=$angle&nc",
|
||||
"&rb=$angle&nc&w=200",
|
||||
"&rb=$angle&nc&h=200",
|
||||
"&rb=$angle&nc&w=200&h=200&cf",
|
||||
"&ra=$angle&nc",
|
||||
"&ra=$angle&nc&w=200",
|
||||
"&ra=$angle&nc&h=200",
|
||||
"&ra=$angle&nc&w=200&h=200&cf",
|
||||
);
|
||||
?>
|
||||
|
||||
|
||||
<h2>Images used in test</h2>
|
||||
|
||||
<p>The following images are used for this test.</p>
|
||||
|
||||
<?php foreach($images as $image) : ?>
|
||||
<p><code><a href="img/<?=$image?>"><?=$image?></a></code><br>
|
||||
<img src="<?=$imgphp . $image?>"></p>
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
||||
<h2>Testcases used for each image</h2>
|
||||
|
||||
<p>The following testcases are used for each image.</p>
|
||||
|
||||
<?php foreach($testcase as $tc) : ?>
|
||||
<code><?=$tc?></code><br>
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
||||
<h2>Applying testcase for each image</h2>
|
||||
|
||||
<?php foreach($images as $image) : ?>
|
||||
<h3><?=$image?></h3>
|
||||
|
||||
<p><code><a href="img/<?=$image?>"><?=$image?></a></code><br>
|
||||
<img src="<?=$imgphp . $image?>"></p>
|
||||
|
||||
<?php foreach($testcase as $tc) : ?>
|
||||
<h4><?=$tc?></h4>
|
||||
|
||||
<p><code><a href="<?=$imgphp . $image . $tc?>"><?=$image . $tc?></a></code><br>
|
||||
<img src="<?=$imgphp . $image . $tc?>"></p>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
|
78
webroot/test_issue36_rb-ra-45.php
Normal file
78
webroot/test_issue36_rb-ra-45.php
Normal file
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
$angle = 45;
|
||||
?><!doctype html>
|
||||
<head>
|
||||
<meta charset='utf-8'/>
|
||||
<title>Testing img for issue 36 - rotateBefore, rotateAfter <?=$angle?></title>
|
||||
<style>
|
||||
body {background-color: #ccc;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Testing issue 36 - rotateBefore, rotateAfter <?=$angle?></h1>
|
||||
|
||||
<?php
|
||||
error_reporting(-1); // Report all type of errors
|
||||
ini_set('display_errors', 1); // Display all errors
|
||||
ini_set('output_buffering', 0); // Do not buffer outputs, write directly
|
||||
|
||||
$imgphp = "img.php?src=";
|
||||
|
||||
$images = array(
|
||||
'kodim08.png',
|
||||
'kodim04.png',
|
||||
);
|
||||
|
||||
$testcase = array(
|
||||
"&rb=$angle&bgc=ffffff&nc",
|
||||
"&rb=$angle&bgc=ffffff&nc&w=200",
|
||||
"&rb=$angle&bgc=ffffff&nc&h=200",
|
||||
"&rb=$angle&bgc=ffffff&nc&w=200&h=200&cf",
|
||||
"&rb=$angle&bgc=ffffff&nc&w=200&h=200&cf&crop=200,200,center,center",
|
||||
"&ra=$angle&bgc=ffffff&nc",
|
||||
"&ra=$angle&bgc=ffffff&nc&w=200",
|
||||
"&ra=$angle&bgc=ffffff&nc&h=200",
|
||||
"&ra=$angle&bgc=ffffff&nc&w=200&h=200&cf",
|
||||
"&ra=$angle&bgc=ffffff&nc&w=200&h=200&cf&crop=200,200,center,center",
|
||||
);
|
||||
?>
|
||||
|
||||
|
||||
<h2>Images used in test</h2>
|
||||
|
||||
<p>The following images are used for this test.</p>
|
||||
|
||||
<?php foreach($images as $image) : ?>
|
||||
<p><code><a href="img/<?=$image?>"><?=$image?></a></code><br>
|
||||
<img src="<?=$imgphp . $image?>"></p>
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
||||
<h2>Testcases used for each image</h2>
|
||||
|
||||
<p>The following testcases are used for each image.</p>
|
||||
|
||||
<?php foreach($testcase as $tc) : ?>
|
||||
<code><?=$tc?></code><br>
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
||||
<h2>Applying testcase for each image</h2>
|
||||
|
||||
<?php foreach($images as $image) : ?>
|
||||
<h3><?=$image?></h3>
|
||||
|
||||
<p><code><a href="img/<?=$image?>"><?=$image?></a></code><br>
|
||||
<img src="<?=$imgphp . $image?>"></p>
|
||||
|
||||
<?php foreach($testcase as $tc) : ?>
|
||||
<h4><?=$tc?></h4>
|
||||
|
||||
<p><code><a href="<?=$imgphp . $image . $tc?>"><?=$image . $tc?></a></code><br>
|
||||
<img src="<?=$imgphp . $image . $tc?>"></p>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
|
76
webroot/test_issue36_rb-ra-90.php
Normal file
76
webroot/test_issue36_rb-ra-90.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
$angle = 90;
|
||||
?><!doctype html>
|
||||
<head>
|
||||
<meta charset='utf-8'/>
|
||||
<title>Testing img for issue 36 - rotateBefore, rotateAfter <?=$angle?></title>
|
||||
<style>
|
||||
body {background-color: #ccc;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Testing issue 36 - rotateBefore, rotateAfter <?=$angle?></h1>
|
||||
|
||||
<?php
|
||||
error_reporting(-1); // Report all type of errors
|
||||
ini_set('display_errors', 1); // Display all errors
|
||||
ini_set('output_buffering', 0); // Do not buffer outputs, write directly
|
||||
|
||||
$imgphp = "img.php?src=";
|
||||
|
||||
$images = array(
|
||||
'kodim08.png',
|
||||
'kodim04.png',
|
||||
);
|
||||
|
||||
$testcase = array(
|
||||
"&rb=$angle&nc",
|
||||
"&rb=$angle&nc&w=200",
|
||||
"&rb=$angle&nc&h=200",
|
||||
"&rb=$angle&nc&w=200&h=200&cf",
|
||||
"&ra=$angle&nc",
|
||||
"&ra=$angle&nc&w=200",
|
||||
"&ra=$angle&nc&h=200",
|
||||
"&ra=$angle&nc&w=200&h=200&cf",
|
||||
);
|
||||
?>
|
||||
|
||||
|
||||
<h2>Images used in test</h2>
|
||||
|
||||
<p>The following images are used for this test.</p>
|
||||
|
||||
<?php foreach($images as $image) : ?>
|
||||
<p><code><a href="img/<?=$image?>"><?=$image?></a></code><br>
|
||||
<img src="<?=$imgphp . $image?>"></p>
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
||||
<h2>Testcases used for each image</h2>
|
||||
|
||||
<p>The following testcases are used for each image.</p>
|
||||
|
||||
<?php foreach($testcase as $tc) : ?>
|
||||
<code><?=$tc?></code><br>
|
||||
<?php endforeach; ?>
|
||||
|
||||
|
||||
|
||||
<h2>Applying testcase for each image</h2>
|
||||
|
||||
<?php foreach($images as $image) : ?>
|
||||
<h3><?=$image?></h3>
|
||||
|
||||
<p><code><a href="img/<?=$image?>"><?=$image?></a></code><br>
|
||||
<img src="<?=$imgphp . $image?>"></p>
|
||||
|
||||
<?php foreach($testcase as $tc) : ?>
|
||||
<h4><?=$tc?></h4>
|
||||
|
||||
<p><code><a href="<?=$imgphp . $image . $tc?>"><?=$image . $tc?></a></code><br>
|
||||
<img src="<?=$imgphp . $image . $tc?>"></p>
|
||||
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
|
Loading…
x
Reference in New Issue
Block a user