PHPackages                             indent/imgcache - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. indent/imgcache

ActiveLibrary

indent/imgcache
===============

Automagically cache images from any source in your Laravel app

1323PHP

Since May 19Pushed 4y ago2 watchersCompare

[ Source](https://github.com/s360digital/imgcache)[ Packagist](https://packagist.org/packages/indent/imgcache)[ RSS](/packages/indent-imgcache/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Imgcache [![Build Status](https://camo.githubusercontent.com/233a9420faab3e0a9e2c8a2e0136797b4bd673e5d7a917cbad19d6082c0a1d36/68747470733a2f2f6170702e7472617669732d63692e636f6d2f733336306469676974616c2f696d6763616368652e7376673f6272616e63683d6d6173746572)](https://app.travis-ci.com/s360digital/imgcache)
================================================================================================================================================================================================================================================================================================================

[](#imgcache-)

> Cache any image from any source locally in your Laravel app

### Installation

[](#installation)

1. Install using Composer

```
composer require indent/imgcache --prefer-dist
```

2. Create symbolic link between `public/` directory and `storage/imgcache/`

```
php artisan imgcache:link
```

3. Add your Cloudinary cloud name in `config/services.php`. You can find your cloud name in the Cloudinary dashboard.

```
return [
    'imgcache' => [
        'cloudinary' => [
            'cloud_name' => env('CLOUDINARY_CLOUD_NAME', ''),
        ],
    ],
];
```

### Usage

[](#usage)

Use Imgcache by calling the fascade or use the global helper.

#### Fascade

[](#fascade)

```
class ProductController
{
    public function show()
    {
        $img = Imgcache::make('https://picsum.photos/id/1/100/100')->get();

        return view('product.show', [
            'img' => $img,
        ]);
    }
}
```

#### Helper

[](#helper)

The global helper is useful when rendering an image in HTML or Blade views

```
{{-- When called in a Blade view Imgcache will be stringified --}}
get() }} alt="...">
```

#### Inline hashes

[](#inline-hashes)

You can generate very small image hashes to load inline in your Blade templates, then lazy load the actual image later.

```
