mirror of
https://github.com/mosbth/cimage.git
synced 2025-04-21 17:31:58 +02:00
initial release
This commit is contained in:
parent
580b3a46f9
commit
980b4cce3c
11
CImage.php
11
CImage.php
@ -1,10 +1,10 @@
|
||||
<?php
|
||||
/**
|
||||
* Resizing images on the fly.
|
||||
* Resize and crop images on the fly. Store generated images in a cache.
|
||||
*
|
||||
* @author Mikael Roos mos@dbwebb.se
|
||||
* @example http://dbwebb.se/example/lessphp/
|
||||
* @link https://github.com/mosbth/Utility/blob/master/style.php
|
||||
* @example http://mikaelroos.se/cimage/test.php
|
||||
* @link https://github.com/mosbth/cimage
|
||||
*/
|
||||
class CImage {
|
||||
|
||||
@ -211,11 +211,6 @@ class CImage {
|
||||
* @param $imageQuality number the quality to use when saving the file, default is full quality.
|
||||
*/
|
||||
public function ResizeAndSave($imageQuality="100") {
|
||||
|
||||
//echo "{$this->width}:{$this->height}:{$this->mime}</br>";
|
||||
//echo "{$this->cropWidth}:{$this->cropHeight}</br>";
|
||||
//echo "{$this->newWidth}:{$this->newHeight}</br>";
|
||||
|
||||
if($this->crop) {
|
||||
$cropX = ($this->cropWidth/2) - ($this->newWidth/2);
|
||||
$cropY = ($this->cropHeight/2) - ($this->newHeight/2);
|
||||
|
2
img.php
2
img.php
@ -30,5 +30,5 @@ if(isset($newHeight)) {
|
||||
|
||||
// Create the image object
|
||||
require(__DIR__.'/CImage.php');
|
||||
$img = new CImage($srcImage, $newWidth, $newHeight, $keepRatio, $crop, null/*$pathToCache*/);
|
||||
$img = new CImage($srcImage, $newWidth, $newHeight, $keepRatio, $crop, $pathToCache);
|
||||
$img->ResizeAndOutput();
|
3
test.php
3
test.php
@ -13,7 +13,10 @@
|
||||
<li>crop: together with both h & w makes the image fit in the box.
|
||||
<li>no-ratio: do not keep aspect ratio.
|
||||
</ul>
|
||||
<p>Sourcecode and issues on github: <a href='https://github.com/mosbth/cimage'>https://github.com/mosbth/cimage</a></p>
|
||||
<p>Mikael Roos (mos@dbwebb.se)</p>
|
||||
|
||||
<h2>Testcases</h2>
|
||||
<table>
|
||||
<caption>Test cases</caption>
|
||||
<thead><tr><th>Testcase:</th><th>Result:</th></tr></thead>
|
||||
|
Loading…
x
Reference in New Issue
Block a user