mirror of
https://github.com/mosbth/cimage.git
synced 2025-08-05 07:37:37 +02:00
prepare to run on circleci
This commit is contained in:
@@ -3,6 +3,7 @@ Image conversion on the fly using PHP
|
||||
|
||||
[](https://gitter.im/mosbth/cimage?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||
[](https://travis-ci.org/mosbth/cimage)
|
||||
[](https://circleci.com/gh/mosbth/cimage)
|
||||
[](https://scrutinizer-ci.com/g/mosbth/cimage/build-status/resize)
|
||||
[](https://scrutinizer-ci.com/g/mosbth/cimage/?branch=resize)
|
||||
[](https://scrutinizer-ci.com/g/mosbth/cimage/?branch=resize)
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* Create an ASCII version of an image.
|
||||
*
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* Deal with the cache directory and cached items.
|
||||
*
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* Enable a fast track cache with a json representation of the image delivery.
|
||||
*
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* Get a image from a remote server using HTTP GET and If-Modified-Since.
|
||||
*
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* Resize and crop images on the fly, store generated images in a cache.
|
||||
*
|
||||
@@ -2561,7 +2564,7 @@ class CImage
|
||||
$this->log("# Converting image to sRGB colorspace.");
|
||||
}
|
||||
|
||||
if (!class_exists("Imagick")) {
|
||||
if (!class_exists("\Imagick")) {
|
||||
$this->log(" Ignoring since Imagemagick is not installed.");
|
||||
return false;
|
||||
}
|
||||
@@ -2585,7 +2588,7 @@ class CImage
|
||||
// Only convert if cachedir is writable
|
||||
if (is_writable($this->saveFolder)) {
|
||||
// Load file and check if conversion is needed
|
||||
$image = new Imagick($this->pathToImage);
|
||||
$image = new \Imagick($this->pathToImage);
|
||||
$colorspace = $image->getImageColorspace();
|
||||
$this->log(" Current colorspace: " . $colorspace);
|
||||
|
||||
@@ -2593,13 +2596,13 @@ class CImage
|
||||
$hasICCProfile = (array_search('icc', $profiles) !== false);
|
||||
$this->log(" Has ICC color profile: " . ($hasICCProfile ? "YES" : "NO"));
|
||||
|
||||
if ($colorspace != Imagick::COLORSPACE_SRGB || $hasICCProfile) {
|
||||
if ($colorspace != \Imagick::COLORSPACE_SRGB || $hasICCProfile) {
|
||||
$this->log(" Converting to sRGB.");
|
||||
|
||||
$sRGBicc = file_get_contents($iccFile);
|
||||
$image->profileImage('icc', $sRGBicc);
|
||||
|
||||
$image->transformImageColorspace(Imagick::COLORSPACE_SRGB);
|
||||
$image->transformImageColorspace(\Imagick::COLORSPACE_SRGB);
|
||||
$image->writeImage($this->cacheFileName);
|
||||
return $this->cacheFileName;
|
||||
}
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* Resize and crop images.
|
||||
*
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* Get a image from a remote server using HTTP GET and If-Modified-Since.
|
||||
*
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* Act as whitelist (or blacklist).
|
||||
*
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* A testclass
|
||||
*
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* A testclass
|
||||
*
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* A testclass
|
||||
*
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* A testclass
|
||||
*
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* A testclass
|
||||
*
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* A testclass
|
||||
*
|
||||
@@ -12,26 +15,26 @@ class CImageResizerStrategyCropToFitTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function providerImages()
|
||||
{
|
||||
return array(
|
||||
return [
|
||||
|
||||
// Square
|
||||
array(100, 100, 200, 200, 0, 0, 100, 100),
|
||||
array(100, 100, 200, 100, 0, 25, 100, 50),
|
||||
array(100, 100, 100, 200, 25, 0, 50, 100),
|
||||
[100, 100, 200, 200, 0, 0, 100, 100],
|
||||
[100, 100, 200, 100, 0, 25, 100, 50],
|
||||
[100, 100, 100, 200, 25, 0, 50, 100],
|
||||
|
||||
// Landscape
|
||||
array(200, 100, 400, 200, 0, 0, 200, 100),
|
||||
array(200, 100, 50, 50, 50, 0, 100, 100),
|
||||
array(200, 100, 400, 100, 0, 25, 200, 50),
|
||||
array(200, 100, 100, 400, round(175/2), 0, 25, 100),
|
||||
[200, 100, 400, 200, 0, 0, 200, 100],
|
||||
[200, 100, 50, 50, 50, 0, 100, 100],
|
||||
[200, 100, 400, 100, 0, 25, 200, 50],
|
||||
[200, 100, 100, 400, round(175/2), 0, 25, 100],
|
||||
|
||||
// Portrait
|
||||
array(100, 200, 50, 100, 0, 0, 100, 200),
|
||||
array(100, 200, 50, 50, 0, 50, 100, 100),
|
||||
array(100, 200, 200, 50, 0, round(175/2), 100, 25),
|
||||
array(100, 200, 50, 200, 25, 0, 50, 200),
|
||||
[100, 200, 50, 100, 0, 0, 100, 200],
|
||||
[100, 200, 50, 50, 0, 50, 100, 100],
|
||||
[100, 200, 200, 50, 0, round(175/2), 100, 25],
|
||||
[100, 200, 50, 200, 25, 0, 50, 200],
|
||||
|
||||
);
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -73,22 +76,22 @@ class CImageResizerStrategyCropToFitTest extends \PHPUnit_Framework_TestCase
|
||||
return [
|
||||
|
||||
// Square
|
||||
array(100,100, 200,200, 0,0,100,100, 50,50,100,100),
|
||||
array(100,100, 200,100, 0,0,100,100, 50,0,100,100),
|
||||
array(100,100, 100,200, 0,0,100,100, 0,50,100,100),
|
||||
[100,100, 200,200, 0,0,100,100, 50,50,100,100],
|
||||
[100,100, 200,100, 0,0,100,100, 50,0,100,100],
|
||||
[100,100, 100,200, 0,0,100,100, 0,50,100,100],
|
||||
|
||||
// Landscape
|
||||
array(200,100, 400,200, 0,0,200,100, 100,50,200,100),
|
||||
array(200,100, 50,50, 50,0,100,100, 0,0,200,100),
|
||||
[200,100, 400,200, 0,0,200,100, 100,50,200,100],
|
||||
//[200,100, 50,50, 50,0,100,100, 0,0,200,100],
|
||||
/*
|
||||
array(200, 100, 400, 100, 0, 25, 200, 50),
|
||||
array(200, 100, 100, 400, round(175/2), 0, 25, 100),
|
||||
[200, 100, 400, 100, 0, 25, 200, 50],
|
||||
[200, 100, 100, 400, round(175/2), 0, 25, 100],
|
||||
|
||||
// Portrait
|
||||
array(100, 200, 50, 100, 0, 0, 100, 200),
|
||||
array(100, 200, 50, 50, 0, 50, 100, 100),
|
||||
array(100, 200, 200, 50, 0, round(175/2), 100, 25),
|
||||
array(100, 200, 50, 200, 25, 0, 50, 200),
|
||||
[100, 200, 50, 100, 0, 0, 100, 200],
|
||||
[100, 200, 50, 50, 0, 50, 100, 100],
|
||||
[100, 200, 200, 50, 0, round(175/2), 100, 25],
|
||||
[100, 200, 50, 200, 25, 0, 50, 200],
|
||||
/* */
|
||||
];
|
||||
}
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* A testclass
|
||||
*
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* A testclass
|
||||
*
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* A testclass
|
||||
*
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* A testclass
|
||||
*
|
||||
@@ -59,7 +62,7 @@ class CImageResizerTest extends \PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testLogger()
|
||||
{
|
||||
$img = new CImageResizer('loggerDummy');
|
||||
$img = new CImageResizer('Mos\CImage\loggerDummy');
|
||||
|
||||
$img->setBaseWidthHeight(100, 100);
|
||||
}
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* A testclass
|
||||
*
|
||||
|
@@ -1,4 +1,7 @@
|
||||
<?php
|
||||
|
||||
namespace Mos\CImage;
|
||||
|
||||
/**
|
||||
* A testclass
|
||||
*
|
||||
|
Reference in New Issue
Block a user