{"id":36993565,"url":"https://github.com/artisansweb/image-optimizer","last_synced_at":"2026-01-13T23:45:45.532Z","repository":{"id":56033919,"uuid":"246817157","full_name":"artisansweb/image-optimizer","owner":"artisansweb","description":"Image optimization using PHP","archived":false,"fork":false,"pushed_at":"2020-11-30T00:33:17.000Z","size":5487,"stargazers_count":33,"open_issues_count":1,"forks_count":16,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-31T21:22:52.279Z","etag":null,"topics":["gif","image","jpg","optimize","performance","php","png"],"latest_commit_sha":null,"homepage":"https://artisansweb.net/image-optimization-using-artisansweb-image-optimizer-package","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/artisansweb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-12T11:29:00.000Z","updated_at":"2025-03-30T13:23:49.000Z","dependencies_parsed_at":"2022-08-15T11:50:41.683Z","dependency_job_id":null,"html_url":"https://github.com/artisansweb/image-optimizer","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/artisansweb/image-optimizer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artisansweb%2Fimage-optimizer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artisansweb%2Fimage-optimizer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artisansweb%2Fimage-optimizer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artisansweb%2Fimage-optimizer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artisansweb","download_url":"https://codeload.github.com/artisansweb/image-optimizer/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artisansweb%2Fimage-optimizer/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28405298,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T21:51:37.118Z","status":"ssl_error","status_checked_at":"2026-01-13T21:45:14.585Z","response_time":56,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["gif","image","jpg","optimize","performance","php","png"],"created_at":"2026-01-13T23:45:45.373Z","updated_at":"2026-01-13T23:45:45.465Z","avatar_url":"https://github.com/artisansweb.png","language":"PHP","readme":"# Image optimization using PHP\n\nThis library helps you to compress JPGs, PNGs, GIFs images on the fly. Apart from this package, you don't need to install any additional software or package to perform optimization task.\n\n## Installation\n\nYou can install the package via composer:\n\n```bash\ncomposer require artisansweb/image-optimizer\n```\n\nUnder the hood, this package uses [resmush.it](http://resmush.it) service to compress the images. Alternatively, package using native PHP functions - [imagecreatefromjpeg](https://www.php.net/manual/en/function.imagecreatefromjpeg.php), [imagecreatefrompng](https://www.php.net/manual/en/function.imagecreatefrompng.php), [imagecreatefromgif](https://www.php.net/manual/en/function.imagecreatefromgif.php), [imagejpeg](https://www.php.net/manual/en/function.imagejpeg.php).\n\n## Usage\n\nThis package is straight-forward to use. All you need to do is pass source path of your image.\n\n```php\nuse ArtisansWeb\\Optimizer;\n\n$img = new Optimizer();\n\n$source = 'SOURCE_PATH_OF_IMAGE';\n$img-\u003eoptimize($source);\n```\n\nAbove code will optimize the image and replace the original image with the optimized version.\n\nOptionally, you can also pass destination path where optimized version will stored.\n\n```php\n$source = 'SOURCE_PATH_OF_IMAGE';\n$destination = 'DESTINATION_PATH_OF_IMAGE';\n$img-\u003eoptimize($source, $destination);\n```\n\nRecommeded way of using this code is on image upload. The user should optimize image on upload which will result in better performance.\n\nLet's say you want to store optimized version in the 'images' folder. You can use the below code for this purpose.\n\n```php\n\u003c?php\nrequire_once \"vendor/autoload.php\";\n\nuse ArtisansWeb\\Optimizer;\n\nif (isset($_POST['submit'])) {\n    $img = new Optimizer();\n    move_uploaded_file($_FILES['file']['tmp_name'], 'images/'.$_FILES['file']['name']);\n    $img-\u003eoptimize('images/'.$_FILES['file']['name']);\n}\n?\u003e\n\n\u003cform method=\"post\" enctype=\"multipart/form-data\"\u003e\n    \u003cinput type=\"file\" name=\"file\" /\u003e\n    \u003cinput type=\"submit\" name=\"submit\" value=\"Submit\" /\u003e\n\u003c/form\u003e\n```\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartisansweb%2Fimage-optimizer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartisansweb%2Fimage-optimizer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartisansweb%2Fimage-optimizer/lists"}