{"id":13828204,"url":"https://github.com/coderello/laravel-proximage","last_synced_at":"2026-01-11T16:29:35.471Z","repository":{"id":56955630,"uuid":"152429570","full_name":"coderello/laravel-proximage","owner":"coderello","description":"🌐 Laravel Proximage is a handy package for proxying images.","archived":false,"fork":false,"pushed_at":"2023-08-07T12:58:16.000Z","size":235,"stargazers_count":160,"open_issues_count":1,"forks_count":14,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-07T10:18:49.251Z","etag":null,"topics":["image","laravel","proximage","proxy"],"latest_commit_sha":null,"homepage":"","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/coderello.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","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":"2018-10-10T13:37:56.000Z","updated_at":"2024-11-04T02:40:38.000Z","dependencies_parsed_at":"2024-06-21T04:18:31.977Z","dependency_job_id":"5fd87181-73a5-4486-bc98-edd3c39ca12c","html_url":"https://github.com/coderello/laravel-proximage","commit_stats":{"total_commits":62,"total_committers":7,"mean_commits":8.857142857142858,"dds":"0.22580645161290325","last_synced_commit":"7dc0754f6f433f90f3c23388326f08e57f813022"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderello%2Flaravel-proximage","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderello%2Flaravel-proximage/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderello%2Flaravel-proximage/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coderello%2Flaravel-proximage/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coderello","download_url":"https://codeload.github.com/coderello/laravel-proximage/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225486570,"owners_count":17481930,"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":["image","laravel","proximage","proxy"],"created_at":"2024-08-04T09:02:36.455Z","updated_at":"2026-01-11T16:29:35.410Z","avatar_url":"https://github.com/coderello.png","language":"PHP","funding_links":[],"categories":["PHP"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg alt=\"Proximage\" src=\"https://coderello.com/images/packages/laravel-proximage.png\" width=\"450\"\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003cb\u003eProximage\u003c/b\u003e is a handy package for proxying images through the \u003ca href=\"https://images.weserv.nl\"\u003eimages.weserv.nl\u003c/a\u003e (free image cache \u0026 resize service) with which you can greatly increase the performance of the site.\u003c/p\u003e\n\n## Installation\n\nYou can install this package via composer using this command:\n\n```bash\ncomposer require coderello/laravel-proximage\n```\n\nThe package will automatically register itself.\n\nYou can publish the config file with:\n\n```bash\nphp artisan vendor:publish --tag=\"proximage-config\"\n```\n\n## Some important notes\n\n\u003e Images are **not** processed on your server (package generates a link to your image processed by a third-party service).\n\n\u003e The only way to specify an input image is to pass its **public link**.\n\n## Examples of use\n\nOnly caching:\n\n```php\nproximage($imageUrl)\n  -\u003eget();\n```\n\nCaching and resizing:\n```php\nproximage($imageUrl)\n  -\u003ewidth(300)\n  -\u003eget();\n```\n\nCaching and cropping:\n```php\nuse Coderello\\Proximage\\Enums\\Parameter;\n```\n```php\nproximage($imageUrl)\n  -\u003ecrop(Parameter\\CropAlignment::CENTER)\n  -\u003etransformation(Parameter\\Transformation::SQUARE)\n  -\u003eget();\n```\n\n## Basic methods\n\n### url(?string $value): self\n\nSets the link to your input image.\n\n### parameter(string $name, $value): self\n\nSets the value of the parameter by its name.\n\nYou can find all existing parameter names in `Parameter` enum situated in `Coderello\\Proximage\\Enums` namespace.\n\n\u003e More handy way is to use methods for image manipulations which can be found in the section below.\n\n### shouldProxy(Closure $shouldProxy): self\n\nSets callback which detects if given image should be proxied. Callback receives `$url` as the first argument and should return `true` or `false`.\n\n### template($template): self\n\nApplies template to the current `ImageProxy` instance.\n\n**Accepts:**\n\n- `string` (template class name)\n- `object` (template instance)\n\n**Out-of-the-box templates (you can find them in `Coderello\\Proximage\\Templates` namespace):**\n\n- `AvatarTemplate`\n- `DisableProxyingForLocalEnvironmentTemplate`\n\n\u003e Of course, you are not limited to these ones. You can create your own templates. Each one must implement `Template` contract situated in the `Coderello\\Proximage\\Contracts` namespace.\n\n### get(): ?string\n\nReturns URL of proxied image.\n\n## Methods for image manipulations \n\n### width($value): self\n\nSets the width of the image, in pixels.\n\n### height($value): self\n\nSets the height of the image, in pixels.\n\n### devicePixelRatio($value): self\n\nThe device pixel ratio is used to easily convert between CSS pixels and device pixels. This makes it possible to display images at the correct pixel density on a variety of devices such as Apple devices with Retina Displays and Android devices. You must specify either a width, a height, or both for this parameter to work. Use values between `1` and `8`.\n\n### transformation($value): self\n\nControls how the image is fitted to its target dimensions.\n\nNamespace of enum with possible values: `Coderello\\Proximage\\Enums\\Parameter\\Transformation`\n\n**Accepts:**\n\n- `Transformation::FIT`\n\nDefault. Resizes the image to fit within the width and height boundaries without cropping, distorting or altering the aspect ratio. Will not oversample the image if the requested size is larger than that of the original.\n\n- `Transformation::FIT_UP`\n\nResizes the image to fit within the width and height boundaries without cropping, distorting or altering the aspect ratio. Will increase the size of the image if it is smaller than the output size.\n\n- `Transformation::SQUARE`\n\nResizes the image to fill the width and height boundaries and crops any excess image data. The resulting image will match the width and height constraints without distorting the image. Will increase the size of the image if it is smaller than the output size.\n\n- `Transformation::SQUARE_DOWN`\n\nResizes the image to fill the width and height boundaries and crops any excess image data. The resulting image will match the width and height constraints without distorting the image. Will not oversample the image if the requested size is larger than that of the original.\n\n- `Transformation::ABSOLUTE`\n\nStretches the image to fit the constraining dimensions exactly. The resulting image will fill the dimensions, and will not maintain the aspect ratio of the input image.\n\n- `Transformation::LETTERBOX`\n\nResizes the image to fit within the width and height boundaries without cropping or distorting the image, and the remaining space is filled with the background color. The resulting image will match the constraining dimensions.\n\n### crop($value): self\n\nControls how the image is aligned.\n\nNamespace of enum with possible values: `Coderello\\Proximage\\Enums\\Parameter\\CropAlignment`\n\n**Crop position**\n\nYou can set where the image is cropped by adding a crop position. Only works when transformation is `Transformation::SQUARE`. Accepts `CropAlignment::TOP`, `CropAlignment::LEFT`, `CropAlignment::CENTER`, `CropAlignment::RIGHT` or `CropAlignment::BOTTOM`. Default is `CropAlignment::CENTER`.\n\n**Crop focal point**\n\nIn addition to the crop position, you can be more specific about the exact crop position using a focal point. Only works when transformation is `Transformation::SQUARE`. This is defined using two offset percentages: `crop-x%-y%`.\n\n**Smart crop**\n\nCrops the image down to specific dimensions by removing boring parts. Only works when transformation is `Transformation::SQUARE`.\n\nAccepts:\n\n- `CropAlignment::ENTROPY`: focus on the region with the highest Shannon entropy.\n- `CropAlignment::ATTENTION`: focus on the region with the highest luminance frequency, colour saturation and presence of skin tones.\n\n**Manual crop**\n\nCrops the image to specific dimensions after any other resize operations. Required format: `width,height,x,y`.\n\n### mask($value): self\n\nSets the mask type from a predefined list of shapes.\n\nNamespace of enum with possible values: `Coderello\\Proximage\\Enums\\Parameter\\Mask`\n\n**Accepts:**\n\n- `Mask::CIRCLE`\n- `Mask::ELLIPSE`\n- `Mask::TRIANLGE`\n- `Mask::TRIANLGE_180`: triangle tilted upside down\n- `Mask::PENTAGON`\n- `Mask::PENTAGON_180`: pentagon tilted upside down\n- `Mask::HEXAGON`\n- `Mask::SQUARE`: square tilted 45 degrees\n- `Mask::STAR`: 5-point star\n- `Mask::HEART`\n\n### maskTrim($value): self\n\nRemoves the remaining whitespace from the mask.\n\n### maskBackground($value): self\n\nSets the background color of the mask.\n\n### orientation($value): self\n\nRotates the image. Accepts `auto` or if an angle is specified, it is converted to a valid `90`/`180`/`270` degree rotation. For example, `-450` will produce a `270` degree rotation. Default is `auto`. The `auto` option uses Exif data to automatically orient images correctly.\n\n### brightness($value): self\n\nAdjusts the image brightness. Use values between `-100` and `+100`, where `0` represents no change.\n\n### contrast($value): self\n\nAdjusts the image contrast. Use values between `-100` and `+100`, where `0` represents no change.\n\n### gamma($value): self\n\nAdjusts the image gamma. Use values between `1` and `3`. The default value is `2.2`, a suitable approximation for sRGB images.\n\n### sharpen($value): self\n\nSharpen the image. Required format: `f,j,r`\n\n**Arguments:**\n\n- Flat `f` - Sharpening to apply to flat areas. (Default: 1.0)\n- Jagged `j` - Sharpening to apply to jagged areas. (Default: 2.0)\n- Radius `r` - Sharpening mask to apply in pixels, but comes at a performance cost. (optional)\n\n### trim($value): self\n\nTrim \"boring\" pixels from all edges that contain values within a similarity of the top-left pixel. Trimming occurs before any resize operation. Use values between `1` and `254` to define a tolerance level to trim away similar color values. You also can specify just \u0026trim, which defaults to a tolerance level of 10.\n\n### background($value): self\n\nSets the background color of the image. Supports a variety of color formats. In addition to the 140 color names supported by all modern browsers (listed here), it also accepts hexadecimal RGB and RBG alpha formats.\n\n**Hexadecimal**\n\n- 3 digit RGB: `CCC`\n- 4 digit ARGB (alpha): `5CCC`\n- 6 digit RGB: `CCCCCC`\n- 8 digit ARGB (alpha): `55CCCCCC`\n\n### blur($value): self\n\nAdds a blur effect to the image. Use values between `0` and `100`.\n\n### filter($value): self\n\nApplies a filter effect to the image.\n\nNamespace of enum with possible values: `Coderello\\Proximage\\Enums\\Parameter\\Filter`\n\n**Accepts:**\n- `Filter::GREYSCALE`\n- `Filter::SEPIA`\n- `Filter::NEGATE`\n\n### quality($value): self\n\nDefines the quality of the image. Use values between `0` and `100`. Defaults to `85`. Only relevant if the format is set to `Output::JPG`.\n\n### output($value): self\n\nEncodes the image to a specific format. If none is given, it will honor the origin image format.\n\nNamespace of enum with possible values: `Coderello\\Proximage\\Enums\\Parameter\\Output`\n\n**Accepts:**\n- `Output::JPG`\n- `Output::PNG`\n- `Output::GIF`\n- `Output::TIFF`\n- `Output::WEBP`\n\n### interlace($value): self\n\nAdds interlacing to GIF and PNG. JPEG's become progressive.\n\n### encoding($value): self\n\nEncodes the image to be used directly in the src= of the `\u003cimg\u003e`-tag.\n\nNamespace of enum with possible values: `Coderello\\Proximage\\Enums\\Parameter\\Encoding`\n\n**Accepts:**\n- `Encoding::BASE64`\n\n### defaultImage($value): self\n\nIf there is a problem loading an image, then a error is shown. However, there might be a need where instead of giving a broken image to the user, you want a default image to be delivered.\n\n### page($value): self\n\nTo load a given page (for an PDF, TIFF and multi-size ICO file). The value is numbered from zero.\n\n### filename($value): self\n\nTo specify the filename returned in the `Content-Disposition` header. The filename must only contain alphanumeric characters.\n\n## Testing\n\nYou can run the tests with:\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderello%2Flaravel-proximage","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoderello%2Flaravel-proximage","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoderello%2Flaravel-proximage/lists"}