https://github.com/webit-de/compress-images
Compress images with TinyPNG
https://github.com/webit-de/compress-images
cli image-compression php tinypng tinypng-api
Last synced: about 2 months ago
JSON representation
Compress images with TinyPNG
- Host: GitHub
- URL: https://github.com/webit-de/compress-images
- Owner: webit-de
- Created: 2017-02-15T07:56:35.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-08-11T09:41:56.000Z (almost 5 years ago)
- Last Synced: 2025-03-23T22:37:27.638Z (2 months ago)
- Topics: cli, image-compression, php, tinypng, tinypng-api
- Language: PHP
- Size: 4.88 KB
- Stars: 3
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Compress images with TinyPNG
============================Compress all PNG & JPG images within an directory and its subdirectories using the [tinypng.com](https://tinypng.com/) API.
[](https://packagist.org/packages/webit-de/compress-images/)
Requirements
------------* PHP with CLI & CURL modules
* Composer
* A [tinyPNG API Key](https://tinypng.com/developers)Installation
------------Packagist Entry https://packagist.org/packages/webit-de/compress-images/
composer create-project webit-de/compress-images .
Usage
-----php compress-images.php [input directory] [output directory] [API key]
eg:
php compress-images.php /tmp/images/ /tmp/images/ L33T-R2D2
Motivation
----------This script was made to compress all images recursively in a given directory.
It was meant to be a simple, executable example on how to use the TinyPNG API with PHP.
TinyPNG has a great documentation on how to do more stuff like resizing or
using cloud services as target directory:* https://tinypng.com/developers/reference/php
So feel free to use this script as a kickstarter and adapt it to your own needs.
License
-------GNU General Public License version 2
The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html.
Author
------Dan Untenzu ( / [@pixelbrackets](https://github.com/pixelbrackets))
for webit! Gesellschaft für neue Medien mbH (http://www.webit.de/)Changelog
---------https://github.com/webit-de/compress-images/releases/
Contribution
------------This PHP project is Open Source, so please use, patch, extend or fork it.