{"id":26796420,"url":"https://github.com/peterujah/nano-image","last_synced_at":"2025-04-22T19:57:53.290Z","repository":{"id":57038186,"uuid":"359173937","full_name":"peterujah/nano-image","owner":"peterujah","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-09T14:01:34.000Z","size":139,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-29T18:18:34.043Z","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/peterujah.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-18T15:00:11.000Z","updated_at":"2025-03-09T13:57:10.000Z","dependencies_parsed_at":"2024-01-19T03:26:49.477Z","dependency_job_id":"318dfe2c-6bc6-44e4-9dac-33b7b40f5cf5","html_url":"https://github.com/peterujah/nano-image","commit_stats":{"total_commits":34,"total_committers":1,"mean_commits":34.0,"dds":0.0,"last_synced_commit":"e6effe12af6a2e0a8470c0e33b04e112f093bbfb"},"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fnano-image","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fnano-image/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fnano-image/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fnano-image/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterujah","download_url":"https://codeload.github.com/peterujah/nano-image/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250315961,"owners_count":21410473,"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-03-29T18:18:38.976Z","updated_at":"2025-04-22T19:57:53.237Z","avatar_url":"https://github.com/peterujah.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Nano Image\n\nNanoImage is a simple PHP image resize class. It can resize images and display them in the browser or save images in a directory\n\n## Installation\n\nInstallation is super-easy via Composer:\n```md\ncomposer require peterujah/nano-image\n```\n\n## Basic Usage\n\n```php\n$image = new NanoImage();\ntry{\n  $image = $imagine-\u003eopen(\"path/to/save/edit-image-size.jpg\");\n\n  $image-\u003eresize(360, 200, false);\n  $image-\u003esave(\"path/to/save/new-image.jpg\", NanoImage::THUMBNAIL, 80);\n\n  $image-\u003eresize(116, 80, false);\n  $image-\u003esaveAs(\"path/to/save/new-image.jpeg\", NanoImage::THUMBNAIL, 100, NanoImage::JPEG);\n\n  $image-\u003efree();\n}catch(UnsupportedImageException $e){\n  echo $e-\u003egetMessage();\n}\n```\n\n\n---\n\n**Applying Filters**\n```php\n$image = new NanoImage();\n$image-\u003efilter(IMG_FILTER_GRAYSCALE)\n      -\u003efilter(IMG_FILTER_BRIGHTNESS, 30)\n      -\u003eget(90);\n```\nOr:\n```php\n$image-\u003efilters([\n    [IMG_FILTER_CONTRAST, -50],\n    [IMG_FILTER_COLORIZE, 100, 50, 0], // Add color overlay\n])-\u003eget();\n```\n---\n\n```php\n$img = new Peterujah\\NanoBlock\\NanoImage();\n```\nInitialize nano image class for use\n\n\nOpen and load any image from a directory path \u0026 file name\n\n```php\n$img-\u003eopen(__DIR__ . \"/path/to/assets/image.jpg\");\n```\nOr load string containing the image data.\n\n```php\n$img-\u003eload($image_data);\n```\n\nResize an image with the exact width and height passed, for example, 200x200. To resize an image using the aspect ratio set the third parameter to true\n\n```php\n$img-\u003eresize(200, 200, false||true);\n```\n\nBlur image \n```php\n$img-\u003eblur(20);\n```\n\nOnce image manipulation is done, display the output image on the browser. Pass quality of the image\n\n```php\n$img-\u003edisplay($quality);\n```\n\nSave an image to a directory, the first parameter specifies the path, the second sets the image naming option, and the third is image quality (90 by default)\n```php\n$img-\u003esave(__DIR__ . \"/path/to/assets/new-image.jpg\", NanoImage::DEFAULT, $quality);\n```\n\nSave image as\n\n```php\n$img-\u003esaveAs($to,  NanoImage::DEFAULT || NanoImage::THUMBNAIL || NanoImage::TIMESTAMP, $quality, self::JPEG)\n```\n\nReplace the existing image with a new one\n\n```php\n$img-\u003ereplace($to, $quality)\n```\n\nRemove temp image after editing and free memory\n\n```php\n$img-\u003eremove()\n```\n\nFree memory\n\n```php\n$img-\u003efree()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterujah%2Fnano-image","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterujah%2Fnano-image","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterujah%2Fnano-image/lists"}