{"id":19473393,"url":"https://github.com/ethercreative/betterimages","last_synced_at":"2026-05-17T05:36:03.047Z","repository":{"id":30696630,"uuid":"34252616","full_name":"ethercreative/BetterImages","owner":"ethercreative","description":"A better way of generating images code side, for WordPress","archived":false,"fork":false,"pushed_at":"2015-05-29T11:06:45.000Z","size":5888,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-22T12:34:07.716Z","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":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ethercreative.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-04-20T09:55:05.000Z","updated_at":"2023-12-23T05:24:44.000Z","dependencies_parsed_at":"2022-08-26T11:21:25.696Z","dependency_job_id":null,"html_url":"https://github.com/ethercreative/BetterImages","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethercreative%2FBetterImages","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethercreative%2FBetterImages/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethercreative%2FBetterImages/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ethercreative%2FBetterImages/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ethercreative","download_url":"https://codeload.github.com/ethercreative/BetterImages/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240693118,"owners_count":19842401,"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":"2024-11-10T19:18:25.234Z","updated_at":"2026-05-17T05:35:58.026Z","avatar_url":"https://github.com/ethercreative.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BetterImages\nA better way of generating images code side, for WordPress.\n\n## Usage\n### Basic Usage\n```php\n$image; // Set to an image array, id, or local url\n\necho new bi($image)-\u003eresize()-\u003ewidth(500)-\u003eblur(10)-\u003ego();\n```\n\n*You don't have to define the resize method (resize, constrain), or the width or height if you only want to pass the image through some filters*\n\n### Functions\n\n#### bi(mixed $image)\n```php\nnew bi($image);\n```\n\nThe **first function** you will use when creating a BetterImage. ```$image``` can be set to a WP image array, ID, or a local url (remote files are currently not supported).\n\n\n#### resize()\n```php\nbi()-\u003eresize();\n```\n\nSets the method to resize (the default)\n\n* Setting both the width and height will stretch the image (if the aspect ratio is different)\n* You can upscale the image\n* Leaving either (not both) the width or height values unset, or 'auto' will scale the image keeping the original aspect ratio\n\n\n#### constrain()\n```php\nbi()-\u003econstrain();\n```\n\nSets the method to constrain\n\n* The image will resized and cropped to fit within the defined width and height\n\n\n#### width(int $width)\n```php\nbi()-\u003ewidth(500);\n```\n\nSets the width of the new image\n\n\n#### height(int $height)\n```php\nbi()-\u003eheight(500);\n```\n\nSets the height of the new image\n\n\n#### invert()\n```php\nbi()-\u003einvert();\n```\n\nInvert the colours of the image\n\n\n#### grayscale()\n```php\nbi()-\u003egrayscale();\n```\n\nMake the image grayscale (black and white)\n\n\n#### brightness(int $level)\n```php\nbi()-\u003ebrightness(100);\n```\n\nSet the brightness of the image\n\n* Minimum Brightness (darkest): -255\n* No Change: 0\n* Maximum Brightness (lightest): 255\n* ```int $level``` The level of brightness (min: -255, max: 255)\n\n\n#### contrast(int $level)\n```php\nbi()-\u003econtrast(100);\n```\n\nSet the contrast level of the image *(Note the direction, it is opposite to brightness)*\n\n* Minimum Contrast: 100\n* No Change: 0\n* Maximum Contrast: -100\n* ```int $level``` The level of contrast (min: 100, max: -100)\n\n\n#### colorize(int $red, int $green, int $blue, int $alpha)\n```php\nbi()-\u003ecolorize(255, 0, 0, 0);\n```\n\nColorizes the image\n\n* Red, Green, \u0026 Blue values range from -255 to 255, where 0 is no change\n* Alpha values range from 0 (opaque) to 127 (transparent)\n* The alpha value effects the strength of the colorize effect, not the image itself\n* ```int $red``` The red value (min: -255, max: 255)\n* ```int $green``` The green value (min: -255, max: 255)\n* ```int $blue``` The blue value (min: -255, max: 255)\n* ```int $alpha``` The alpha value (min/opaque: 0, max/transparent: 127)\n\n\n#### edgedetect()\n```php\nbi()-\u003eedgedetect();\n```\n\nHighlights the edges of objects in the image on a gray background\n\n\n#### emboss()\n```php\nbi()-\u003eemboss();\n```\n\nCreates an emboss effect on the edges of objects in the image, on a gray background\n\n\n#### blur(int $amount [, string $type = 'gaussian'])\n```php\nbi()-\u003eblur(10, 'selective');\n```\n\nBlurs the image\n\n* Defaults to gaussian blur\n* ```gaussian``` is a traditional blur\n* ```selective``` is much smoother\n* ```int $amount``` The number of times the image is passed through the blur filter\n* ```string $type``` The type of blur (gaussian, selective)\n\n\n#### sharpen()\n```php\nbi()-\u003esharpen();\n```\n\nCreates a sharper image via mean removal\n\n\n#### smooth(float $amount)\n```php\nbi()-\u003esmooth(10);\n```\n\nSmooths the image\n\n* Applies a 9-cell convolution matrix where center pixel has the weight $amount and others weight of 1.0.\n* The result is normalized by dividing the sum with $amount + 8.0 (sum of the matrix).\n* Any float is accepted, large values (in practice: 2048 or more) = no change\n* ```float $amount``` The amount of smoothing\n\n\n#### pixelate(int $amount [, bool $use_advanced = false ])\n```php\nbi()-\u003epixelate(25, true);\n```\n\nPixelate the image\n\n* ```int $pixel_size``` The block size in px\n* ```bool $use_advanced``` Whether or not to use the advanced pixelation effect (default: false)\n\n\n#### go([ bool $force_image_re_save = false ])\n```php\nbi()-\u003ego();\n```\n\nThe **last function** you run in the BetterImages function chain. It triggers all the image manipulations and returns the new image URL.\n\n* ```bool $force_image_re_save``` Re-save the image, even if it already exists (cache breaking)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethercreative%2Fbetterimages","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fethercreative%2Fbetterimages","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fethercreative%2Fbetterimages/lists"}