diff --git a/vendor/composer/LICENSE b/vendor/composer/LICENSE deleted file mode 100644 index f27399a..0000000 --- a/vendor/composer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - -Copyright (c) Nils Adermann, Jordi Boggiano - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is furnished -to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. - diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json deleted file mode 100644 index 86a9724..0000000 --- a/vendor/composer/installed.json +++ /dev/null @@ -1,51 +0,0 @@ -[ - { - "name": "imageoptim/imageoptim", - "version": "1.3.1", - "version_normalized": "1.3.1.0", - "source": { - "type": "git", - "url": "https://github.com/ImageOptim/php-imageoptim-api.git", - "reference": "b73eb5d6747fc181de86b2de50fb158dff463618" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ImageOptim/php-imageoptim-api/zipball/b73eb5d6747fc181de86b2de50fb158dff463618", - "reference": "b73eb5d6747fc181de86b2de50fb158dff463618", - "shasum": "" - }, - "require": { - "php": "^5.4 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.3" - }, - "time": "2017-01-09T23:58:20+00:00", - "type": "library", - "installation-source": "dist", - "autoload": { - "psr-4": { - "ImageOptim\\": "src" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-2-Clause" - ], - "authors": [ - { - "name": "Kornel", - "email": "kornel@imageoptim.com" - } - ], - "description": "ImageOptim API for PHP", - "homepage": "https://imageoptim.com/api", - "keywords": [ - "image", - "optimize", - "performance", - "resize", - "scale" - ] - } -] diff --git a/vendor/imageoptim/imageoptim/.gitignore b/vendor/imageoptim/imageoptim/.gitignore deleted file mode 100644 index d8a7996..0000000 --- a/vendor/imageoptim/imageoptim/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -composer.lock -vendor/ diff --git a/vendor/imageoptim/imageoptim/README.md b/vendor/imageoptim/imageoptim/README.md deleted file mode 100644 index d28f5b8..0000000 --- a/vendor/imageoptim/imageoptim/README.md +++ /dev/null @@ -1,153 +0,0 @@ -# ImageOptim API PHP client - -This library allows you to resize and optimize images using ImageOptim API. - -ImageOptim offers [advanced compression, high-DPI/responsive image mode, and color profile support](https://imageoptim.com/features.html) that are much better than PHP's built-in image resizing functions. - -## Installation - -The easiest is to use [PHP Composer](https://getcomposer.org/): - -```sh -composer require imageoptim/imageoptim -``` - -If you don't use Composer, then `require` or autoload files from the `src` directory. - -## Usage - -First, [register to use the API](https://im2.io/register). - -```php -imageFromURL('http://example.com/photo.jpg') // read this image - ->resize(160, 100, 'crop') // optional: resize to a thumbnail - ->dpr(2) // optional: double number of pixels for high-resolution "Retina" displays - ->getBytes(); // perform these operations and return the image data as binary string - -file_put_contents("images/photo_optimized.jpg", $imageData); -``` - -There's a longer example at the end of the readme. - -### Methods - -#### `API($username)` constructor - - new ImageOptim\API("your api username goes here"); - -Creates new instance of the API. You need to give it [your username](https://im2.io/api/username). - -#### `imageFromPath($filePath)` — local source image - -Creates a new request that will [upload](https://im2.io/api/upload) the image to the API, and then resize and optimize it. The upload method is necessary for optimizing files that are not on the web (e.g. `localhost`, files in `/tmp`). - -For images that have a public URLs (e.g. published on a website) it's faster to use the URL method instead: - -#### `imageFromURL($url)` — remote source image - -Creates a new request that will read the image from the given public URL, and then resize and optimize it. - -Please pass full absolute URL to images on your website. - -Ideally you should supply source image at very high quality (e.g. JPEG saved at 99%), so that ImageOptim can adjust quality itself. If source images you provide are already saved at low quality, ImageOptim will not be able to make them look better. - -#### `resize($width, $height = optional, $fit = optional)` — desired dimensions - -* `resize($width)` — sets maximum width for the image, so it'll be resized to this width. If the image is smaller than this, it won't be enlarged. - -* `resize($width, $height)` — same as above, but image will also have height same or smaller. Aspect ratio is always preserved. - -* `resize($width, $height, 'crop')` — resizes and crops image exactly to these dimensions. - -If you don't call `resize()`, then the original image size will be preserved. - -[See options reference](https://im2.io/api/post#options) for more resizing options. - -#### `dpr($x)` — pixel doubling for responsive images (HTML `srcset`) - -The default is `dpr(1)`, which means image is for regular displays, and `resize()` does the obvious thing you'd expect. - -If you set `dpr(2)` then pixel width and height of the image will be *doubled* to match density of "2x" displays. This is better than `resize($width*2)`, because it also adjusts sharpness and image quality to be optimal for high-DPI displays. - -[See options reference](https://im2.io/api/post#opt-2x) for explanation how DPR works. - -#### `quality($preset)` — if you need even smaller or extra sharp images - -Quality is set as a string, and can be `low`, `medium` or `high`. The default is `medium` and should be good enough for most cases. - -#### `getBytes()` — get the resized image - -Makes request to ImageOptim API and returns optimized image as a string. You should save that to your server's disk. - -ImageOptim performs optimizations that sometimes may take a few seconds, so instead of converting images on the fly on every request, you should convert them once and keep them. - -#### `apiURL()` — debug or use another HTTPS client - -Returns string with URL to `https://im2.io/…` that is equivalent of the options set. You can open this URL in your web browser to get more information about it. Or you can [make a `POST` request to it](https://im2.io/api/post#making-the-request) to download the image yourself, if you don't want to use the `getBytes()` method. - -### Error handling - -All methods throw on error. You can expect the following exception subclasses: - -* `ImageOptim\InvalidArgumentException` means arguments to functions are incorrect and you need to fix your code. -* `ImageOptim\NetworkException` is thrown when there is problem comunicating with the API. You can retry the request. -* `ImageOptim\NotFoundException` is thrown when URL given to `imageFromURL()` returned 404. Make sure paths and urlencoding are correct. [More](https://im2.io/api/post#response). -* `ImageOptim\OriginServerException` is thrown when URL given to `imageFromURL()` returned 4xx or 5xx error. Make sure your server allows access to the file. - -If you're writing a script that processes a large number of images in one go, don't launch it from a web browser, as it will likely time out. It's best to launch such scripts via CLI (e.g. via SSH). - -### Help and info - -See [imageoptim.com/api](https://imageoptim.com/api) for documentation and contact info. I'm happy to help! - -### Example - -This is a script that optimizes an image. Such script usually would be ran when a new image is uploaded to the server. You don't need to run any PHP code to *serve* optimized images. - -The API operates on a single image at a time. When you want to generate multiple image sizes/thumbnails, repeat the whole procedure for each image at each size. - -```php -imageFromURL('http://example.com/photo.jpg'); - -// You set various settings on this object (or none to get the defaults). -$imageParams->quality('low'); -$imageParams->resize(1024); - -// Next, to start the optimizations and get the optimized image, call: -$imageData = $imageParams->getBytes(); - -/* - the getBytes() call may take a while to run, so it's intended to be - called only once per image (e.g. only when a new image is uploaded - to your server). If you'd like to "lazily" optimize arbitrary images - on-the-fly when they're requested, there is a better API for that: - https://im2.io/api/get -*/ - -// Save the image data somewhere on the server, e.g. -file_put_contents("images/photo_optimized.jpg", $imageData); - -// Note that this script only prepares a static image file -// (in this example in images/photo_optimized.jpg), -// and does not serve it to the browser. Once the optimized -// image is saved to disk you should serve it normally -// as you'd do with any regular image file. - -``` - diff --git a/vendor/imageoptim/imageoptim/composer.json b/vendor/imageoptim/imageoptim/composer.json deleted file mode 100644 index 00ca812..0000000 --- a/vendor/imageoptim/imageoptim/composer.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "imageoptim/imageoptim", - "description": "ImageOptim API for PHP", - "minimum-stability": "stable", - "license": "BSD-2-Clause", - "authors": [ - { - "name": "Kornel", - "email": "kornel@imageoptim.com" - } - ], - "homepage": "https://imageoptim.com/api", - "keywords": ["image","resize","optimize","scale","performance"], - "autoload": { - "psr-4" : { - "ImageOptim\\" : "src" - } - }, - "require": { - "php" : "^5.4 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.3" - } -} diff --git a/vendor/imageoptim/imageoptim/examples/optimize_directory.php b/vendor/imageoptim/imageoptim/examples/optimize_directory.php deleted file mode 100644 index 354c1eb..0000000 --- a/vendor/imageoptim/imageoptim/examples/optimize_directory.php +++ /dev/null @@ -1,164 +0,0 @@ -#!/usr/bin/env php - /www/example.com/optimized/hello-640.png\n\n"; - echo "If you have questions, ask support@imageoptim.com\n"; -} - -if (count($_SERVER['argv']) < 4) { // the arg 0 is the command name - usage(); - exit(1); -} - -$argn = 1; -$apiUsername = $_SERVER['argv'][$argn++]; -if (!$apiUsername || ctype_digit($apiUsername) || file_exists($apiUsername)) { - echo "The first argument (". escapeshellarg($apiUsername) . ") must be an ImageOptim API username.\n"; - echo "Get your username from https://imageoptim.com/api/register\n"; - exit(1); -} - -$width = null; -if (count($_SERVER['argv']) > 4 && ctype_digit($_SERVER['argv'][$argn])) { - $width = $_SERVER['argv'][$argn++]; -} - -$sourceDir = $_SERVER['argv'][$argn++]; -if (!is_dir($sourceDir)) { - echo "ERROR: ", $sourceDir, " does not exist or is not a directory.\n\n"; - usage(); - exit(1); -} - -$destDir = $_SERVER['argv'][$argn++]; -if (!is_dir($destDir)) { - if (is_dir(dirname($destDir))) { - if (!mkdir($destDir)) { - echo "ERROR: can't create ", $destDir, ". Please create this directory first.\n"; - exit(1); - } - } else { - echo "ERROR: ", $destDir, " does not exist or is not a directory.\n\n"; - usage(); - exit(1); - } -} - -// Clears symlinks from paths, makes them absolute and comparable -$sourceDir = realpath($sourceDir); -$destDir = realpath($destDir); - -try { - $api = new ImageOptim\API($apiUsername); - - // This is a fancy way of getting a list of all files in a directory - $items = new RecursiveIteratorIterator( - new RecursiveDirectoryIterator($sourceDir, RecursiveDirectoryIterator::SKIP_DOTS), - RecursiveIteratorIterator::SELF_FIRST, - RecursiveIteratorIterator::CATCH_GET_CHILD); - - $nonImage = []; - $skipped = 0; - $done = 0; - - foreach ($items as $item) { - if ($item->isDir()) continue; - $filename = $item->getFilename(); - if (!preg_match('/\.(png|jpe?g|gif|svgz?|bmp|tiff?)/i', $filename)) { - $nonImage[] = $filename; - continue; - } - - $sourcePath = $item->getPathname(); - $destRelPath = substr($sourcePath, strlen($sourceDir)); - $destPath = $destDir . $destRelPath; - - // Append .min extension if source and destination are the same - if ($destPath === $sourcePath && false === strpos($destRelPath, '.min.')) { - $destRelPath = preg_replace('/\.[^.]+$/', '.min$0', $destRelPath); - $destPath = $destDir . $destRelPath; - } - - echo substr($destRelPath,1),"... "; - - if (file_exists($destPath) && filemtime($destPath) > filemtime($sourcePath)) { - echo " already exists (skipped)\n"; - $skipped++; - continue; - } - - // The process preserves directory structure, so it needs to create dirs - $destSubdir = dirname($destPath); - if (!is_dir($destSubdir)) { - if (!mkdir($destSubdir, 0777, true)) { - echo "error: unable to create", $destSubdir,"\n"; - continue; - } - } - - $apiRequest = $api->imageFromPath($sourcePath); - if ($width) { - // You could add more options here - $apiRequest->resize($width); - } - $data = $apiRequest->getBytes(); - if (!file_put_contents($destPath, $data)) { - echo "ERROR: unable to save file $destPath\n"; - break; - } - - $inSize = filesize($sourcePath); - $outSize = strlen($data); - echo "ok (", ($inSize > $outSize ? "$inSize -> $outSize bytes" : "already optimized"), ")\n"; - $done++; - } - - if (count($nonImage)) { - echo "Skipped ", count($nonImage), " non-image file(s) ", implode(', ', array_slice($nonImage, 0, 50)), "\n"; - $nonImage = []; - } - - if ($skipped) { - echo "\nSkipped $skipped alredy-existing file(s) in $destDir"; - } - echo "\nImageOptim API processed $done file(s)\n"; - -} catch(\ImageOptim\AccessDeniedException $e) { - echo "ERROR\n\n"; - echo "Please got to https://imageoptim.com/api/register\n"; - echo "get your API username, and replace '$apiUsername' with\n"; - echo "your new registered API username.\n\n"; - echo $e; - exit(1); -} catch(\Exception $e) { - echo "ERROR\n\n"; - echo $e; - exit(1); -} diff --git a/vendor/imageoptim/imageoptim/phpunit.xml b/vendor/imageoptim/imageoptim/phpunit.xml deleted file mode 100644 index 093e2d2..0000000 --- a/vendor/imageoptim/imageoptim/phpunit.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - test - - - - diff --git a/vendor/imageoptim/imageoptim/test/BasicTest.php b/vendor/imageoptim/imageoptim/test/BasicTest.php deleted file mode 100644 index 34b0960..0000000 --- a/vendor/imageoptim/imageoptim/test/BasicTest.php +++ /dev/null @@ -1,125 +0,0 @@ -api = new ImageOptim\API("testtest"); - } - - /** - * @expectedException \ImageOptim\InvalidArgumentException - */ - public function testRequiresUsername1() { - new ImageOptim\API([]); - } - - /** - * @expectedException \ImageOptim\InvalidArgumentException - * @expectedExceptionMessage username - */ - public function testRequiresUsername2() { - new ImageOptim\API(null); - } - - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage URL - */ - public function testNeedsURL() { - $this->api->imageFromURL('local/path.png'); - } - - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage could not be found - */ - public function testNeedsPath() { - $this->api->imageFromPath('http://nope/path.png'); - } - - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage Width - */ - public function testResizeWidth() { - $this->api->imageFromURL('http://example.com')->resize("bad"); - } - - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage Height - */ - public function testResizeBadHeight() { - $this->api->imageFromURL('http://example.com')->resize(320, "bad", "crop"); - } - - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage Height - */ - public function testResizeNegativeHeight() { - $this->api->imageFromURL('http://example.com')->resize(320, -1, "crop"); - } - - public function testResizeWithoutHeight() { - $this->api->imageFromURL('http://example.com')->resize(320, "fit"); - } - - public function testResizeWithHeight() { - $this->api->imageFromURL('http://example.com')->resize(320, 100, "crop"); - } - - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage Fit - */ - public function testResizeInvalidKeyword() { - $this->api->imageFromURL('http://example.com')->resize(320, 100, "loose"); - } - - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage Height - */ - public function testCropNeedsHeight() { - $this->api->imageFromURL('http://example.com')->resize(320, null, "crop"); - } - - /** - * @expectedException InvalidArgumentException - * @expectedExceptionMessage Height - */ - public function testPadNeedsHeight() { - $this->api->imageFromURL('http://example.com')->resize(320, null, "pad"); - } - - public function testEncodesURLIfNeeded() { - $example = 'http://example.com/%2F'; - $this->assertContains(rawurlencode($example), $this->api->imageFromURL($example)->apiURL()); - } - - public function testPad() { - $apiurl = $this->api->imageFromURL('http://example.com')->resize(10,15,'pad')->bgcolor('#FFffFF')->apiURL(); - - $this->assertInternalType('string', $apiurl); - $this->assertContains('10x15', $apiurl); - $this->assertContains('pad', $apiurl); - $this->assertContains('bgcolor=FFffFF', $apiurl); - } - - public function testChains() { - $c1 = $this->api->imageFromURL('http://example.com')->resize(1280)->optimize()->timeout(34) - ->quality('low')->resize(1280)->dpr('2x')->resize(1280, 300); - - $c2 = $this->api->imageFromURL('http://example.com')->optimize()->resize(1280)->resize(1280) - ->dpr(2)->timeout(34)->resize(1280, 300)->quality('low'); - - $this->assertInternalType('string', $c1->apiURL()); - $this->assertEquals($c1->apiURL(), $c2->apiURL()); - $this->assertContains('quality=low', $c2->apiURL()); - $this->assertContains('2x', $c2->apiURL()); - $this->assertContains('1280x300', $c1->apiURL()); - $this->assertContains('timeout=34', $c1->apiURL()); - $this->assertContains('/http%3A%2F%2Fexample.com', $c1->apiURL()); - } -} diff --git a/vendor/imageoptim/imageoptim/test/OnlineTest.php b/vendor/imageoptim/imageoptim/test/OnlineTest.php deleted file mode 100644 index a215185..0000000 --- a/vendor/imageoptim/imageoptim/test/OnlineTest.php +++ /dev/null @@ -1,49 +0,0 @@ -api = new ImageOptim\API("gnbkrbjhzb"); - } - - public function testFullMonty() { - $imageData = $this->api->imageFromURL('http://example.com/image.png')->resize(160,100,'crop')->dpr('2x')->getBytes(); - - $gdimg = imagecreatefromstring($imageData); - $this->assertEquals(160*2, imagesx($gdimg)); - $this->assertEquals(100*2, imagesy($gdimg)); - } - - public function testUpload() { - $imageData = $this->api->imageFromPath(__dir__ . '/../ImageOptim.png')->resize(32)->getBytes(); - - $gdimg = imagecreatefromstring($imageData); - $this->assertEquals(32, imagesx($gdimg)); - $this->assertEquals(32, imagesy($gdimg)); - } - - /** - * @expectedException ImageOptim\AccessDeniedException - * @expectedExceptionCode 403 - */ - public function testBadKey() { - $api = new ImageOptim\API("zzzzzzzz"); - $api->imageFromURL('http://example.com/image.png')->dpr('2x')->getBytes(); - } - - /** - * @expectedException ImageOptim\OriginServerException - * @expectedExceptionCode 403 - */ - public function testGoodKeyUpstream403() { - $this->api->imageFromURL('https://im2.io/.htdeny')->dpr('2x')->getBytes(); - } - - /** - * @expectedException ImageOptim\NotFoundException - * @expectedExceptionCode 404 - */ - public function testUpstreamError() { - $this->api->imageFromURL('http://fail.example.com/nope')->getBytes(); - } - -}