https://github.com/bangnokia/cdn-image
Laravel CDN image component for blade component.
https://github.com/bangnokia/cdn-image
blade blade-component cdn-image cloudimage laravel
Last synced: 3 months ago
JSON representation
Laravel CDN image component for blade component.
- Host: GitHub
- URL: https://github.com/bangnokia/cdn-image
- Owner: bangnokia
- License: mit
- Created: 2021-04-05T12:27:59.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-02-17T10:00:43.000Z (over 4 years ago)
- Last Synced: 2025-12-14T08:12:51.286Z (6 months ago)
- Topics: blade, blade-component, cdn-image, cloudimage, laravel
- Language: PHP
- Homepage:
- Size: 68.4 KB
- Stars: 4
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: .github/CONTRIBUTING.md
- License: LICENSE.md
- Security: .github/SECURITY.md
Awesome Lists containing this project
README
# Laravel CDN image blade component
[](https://packagist.org/packages/bangnokia/cdn-image)
[](https://github.com/bangnokia/cdn-image/actions?query=workflow%3ATests+branch%3Amaster)
[](https://github.com/bangnokia/cdn-image/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amaster)
[](https://packagist.org/packages/bangnokia/cdn-image)
If your website is running and has lots of images which make it slow, you should start to use a CDN for better speed beside with some convenient operations to manipulate image like resize, filter, convert to webp, etc...
By default, this package supports [statically](https://statically.io/) (a free CDN service out of the box) using via `/img` endpoint.
## Installation
You can install the package via composer:
```bash
composer require bangnokia/cdn-image
```
You can publish the config file with:
```bash
php artisan vendor:publish --provider="BangNokia\CdnImage\CdnImageServiceProvider" --tag="cdn-image-config"
```
Sample config file
```php
'statically',
'services' => [
'statically' => [
'domain' => 'cdn.statically.io'
],
'cloud_image' => [
'domain' => 'cloudimg.io',
'token' => env('CLOUD_IMAGE_TOKEN'),
'version' => env('CLOUD_IMAGE_VERSION', 'v7')
]
]
];
```
Now you should value for the provider you are using in `config/cdn_image.php` config file.
### CDN Providers supported
- [Statically](https://statically.io/)
- [Cloudimage](https://www.cloudimage.io/en/home)
## Usage
The blade `x-img` component supports 3 most used props (at least I thought that):
- `src`
- `width`
- `height`
and
- `query` for other operations which depends on each provider
Example
```html
```
will be rendered to
```html
```
## Testing
```bash
composer test
```
## Changelog
Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.
## Contributing
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
## Security Vulnerabilities
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
## Credits
- [bangnokia](https://github.com/bangnokia)
- [All Contributors](../../contributors)
## License
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.