1
0
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:
Mikael Roos
2017-03-03 22:04:59 +01:00
parent 58d83ba494
commit 0f0d954e61
21 changed files with 90 additions and 29 deletions

View File

@@ -3,6 +3,7 @@ Image conversion on the fly using PHP
[![Join the chat at https://gitter.im/mosbth/cimage](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mosbth/cimage?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Build Status](https://travis-ci.org/mosbth/cimage.svg?branch=resize)](https://travis-ci.org/mosbth/cimage)
[![CircleCI](https://circleci.com/gh/mosbth/cimage.svg?style=svg)](https://circleci.com/gh/mosbth/cimage)
[![Build Status](https://scrutinizer-ci.com/g/mosbth/cimage/badges/build.png?b=resize)](https://scrutinizer-ci.com/g/mosbth/cimage/build-status/resize)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/mosbth/cimage/badges/quality-score.png?b=resize)](https://scrutinizer-ci.com/g/mosbth/cimage/?branch=resize)
[![Code Coverage](https://scrutinizer-ci.com/g/mosbth/cimage/badges/coverage.png?b=resize)](https://scrutinizer-ci.com/g/mosbth/cimage/?branch=resize)

View File

@@ -1,4 +1,7 @@
<?php
namespace Mos\CImage;
/**
* Create an ASCII version of an image.
*

View File

@@ -1,4 +1,7 @@
<?php
namespace Mos\CImage;
/**
* Deal with the cache directory and cached items.
*

View File

@@ -1,4 +1,7 @@
<?php
namespace Mos\CImage;
/**
* Enable a fast track cache with a json representation of the image delivery.
*

View File

@@ -1,4 +1,7 @@
<?php
namespace Mos\CImage;
/**
* Get a image from a remote server using HTTP GET and If-Modified-Since.
*

View File

@@ -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;
}

View File

@@ -1,4 +1,7 @@
<?php
namespace Mos\CImage;
/**
* Resize and crop images.
*

View File

@@ -1,4 +1,7 @@
<?php
namespace Mos\CImage;
/**
* Get a image from a remote server using HTTP GET and If-Modified-Since.
*

View File

@@ -1,4 +1,7 @@
<?php
namespace Mos\CImage;
/**
* Act as whitelist (or blacklist).
*

View File

@@ -1,4 +1,7 @@
<?php
namespace Mos\CImage;
/**
* A testclass
*

View File

@@ -1,4 +1,7 @@
<?php
namespace Mos\CImage;
/**
* A testclass
*

View File

@@ -1,4 +1,7 @@
<?php
namespace Mos\CImage;
/**
* A testclass
*

View File

@@ -1,4 +1,7 @@
<?php
namespace Mos\CImage;
/**
* A testclass
*

View File

@@ -1,4 +1,7 @@
<?php
namespace Mos\CImage;
/**
* A testclass
*

View File

@@ -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],
/* */
];
}

View File

@@ -1,4 +1,7 @@
<?php
namespace Mos\CImage;
/**
* A testclass
*

View File

@@ -1,4 +1,7 @@
<?php
namespace Mos\CImage;
/**
* A testclass
*

View File

@@ -1,4 +1,7 @@
<?php
namespace Mos\CImage;
/**
* A testclass
*

View File

@@ -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);
}

View File

@@ -1,4 +1,7 @@
<?php
namespace Mos\CImage;
/**
* A testclass
*

View File

@@ -1,4 +1,7 @@
<?php
namespace Mos\CImage;
/**
* A testclass
*