{"id":24082157,"url":"https://github.com/levidurfee/tinypng-resize","last_synced_at":"2026-05-15T09:15:40.010Z","repository":{"id":100064587,"uuid":"38453140","full_name":"levidurfee/tinypng-resize","owner":"levidurfee","description":null,"archived":false,"fork":false,"pushed_at":"2015-10-02T14:14:38.000Z","size":409,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-09T23:45:30.779Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/levidurfee.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-02T19:39:34.000Z","updated_at":"2017-12-29T20:30:32.000Z","dependencies_parsed_at":"2023-03-05T06:26:07.249Z","dependency_job_id":null,"html_url":"https://github.com/levidurfee/tinypng-resize","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levidurfee%2Ftinypng-resize","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levidurfee%2Ftinypng-resize/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levidurfee%2Ftinypng-resize/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levidurfee%2Ftinypng-resize/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/levidurfee","download_url":"https://codeload.github.com/levidurfee/tinypng-resize/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240959078,"owners_count":19884909,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-09T23:45:40.530Z","updated_at":"2026-05-15T09:15:39.971Z","avatar_url":"https://github.com/levidurfee.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tinypng-resize\n\n**This repo will be changing over the next couple of days. If you start using it now, be careful when upgrading to 1.0.0. The code will have changed.**\n\n[![Build Status](https://travis-ci.org/levidurfee/tinypng-resize.svg?branch=master)](https://travis-ci.org/levidurfee/tinypng-resize)\n[![build v0.8.2](https://img.shields.io/badge/build-0.8.2-orange.svg)]()\n\n\u003e A service by [TinyPNG](https://tinypng.com). Get a free [API KEY](https://tinypng.com/developers).\n\n**The primary purpose of this repo is to be used with another app that I am still developing. This repo at it's current state can be used by others for image resizing using TinyPNG.**\n\n If you have any issues or requests, please feel free to open an issue. Pull requests are welcome.\n\n[TinyPNG](https://tinypng.com) has been very helpful. Even if you don't use my code, at least check out their site and the services they offer.\n\n## installation\n\nAdd `\"teklife/tinypng-resize\" : \"0.8.*\"` to your `composer.json`. It might look something like this:\n\n```json\n{\n  \"require\": {\n    \"teklife/tinypng-resize\" : \"0.8.*\"\n  }\n}\n```\n\n## example usage\n\nTo simple compress the image:\n\n```php\n\u003c?php\nrequire_once('vendor/autoload.php');\n$tp = new teklife\\Tinypng('YOUR_API_KEY');\n$tp-\u003eshrink('ignore/helicopter-original.png', 'ignore/helicopter-new-levi.png');\n```\n\nTo resize based on width:\n\n```php\n\u003c?php\nrequire_once('vendor/autoload.php');\n$tp = new teklife\\Tinypng('YOUR_API_KEY');\n$tp-\u003eshrink('ignore/helicopter-original.png', 'ignore/helicopter-new-levi.png')-\u003eresize(150);\n```\nTo resize based on height:\n\n```php\n\u003c?php\nrequire_once('vendor/autoload.php');\n$tp = new teklife\\Tinypng('YOUR_API_KEY');\n$tp-\u003eshrink('ignore/helicopter-original.png', 'ignore/helicopter-new-levi.png')-\u003eresize('', 150);\n```\n\nTo set the image max width or height to 150:\n\n```php\nrequire_once('vendor/autoload.php');\n$tp = new teklife\\Tinypng('YOUR_API_KEY');\n$tp-\u003eshrink('ignore/helicopter-original.png', 'ignore/helicopter-new-levi.png')-\u003eresize(150, 150, true);\n```\n\n*The image will either be 150px wide or 150px tall. If it is 150px wide, then the height will be smaller than 150px. If it is 150px tall, then the width will be smaller than 150px. It bases this off the original image size. It will not crop the image.*\n\nTo resize and crop, if necessary 150x150:\n\n```php\nrequire_once('vendor/autoload.php');\n$tp = new teklife\\Tinypng('YOUR_API_KEY');\n$tp-\u003eshrink('ignore/helicopter-original.png', 'ignore/helicopter-new-levi.png')-\u003eresize(150, 150, false, true);\n```\n## quote from TinyPNG\n\n\u003e Images are resized by using the aspect ratio of the original image. Either the width or the height can be provided.\n\nThis may change.\n\n## todo\n\n- [ ] [#7](https://github.com/levidurfee/tinypng-resize/issues/7) when 1.0.0 is ready add it to packagist\n- [ ] [#6](https://github.com/levidurfee/tinypng-resize/issues/6) write more tests\n- [x] [#8](https://github.com/levidurfee/tinypng-resize/issues/8) make resizing an option and not the main purpose of this code\n- [ ] additional features\n  - [ ] [#5](https://github.com/levidurfee/tinypng-resize/issues/5) add in new S3 feature\n  - [ ] [#4](https://github.com/levidurfee/tinypng-resize/issues/4) store previous unique reference urls so the original doesn't have to be uploaded each time\n    - [ ] store the filename, md5 sum, and unique reference url of the image in a sqlite db\n- [x] finish fopenShrink method for people who do not have curl\n- [x] get tests working on travis-ci tests\n- [x] add to packagist when done - 0.8.0 is added to packagist.\n\nUsing [RequestBin](http://requestb.in/) for some testing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevidurfee%2Ftinypng-resize","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flevidurfee%2Ftinypng-resize","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevidurfee%2Ftinypng-resize/lists"}