Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdekruijk authored Jul 11, 2018
1 parent 958ade5 commit ce8975b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ After installing for the first time publish the config file with
A default config file called `imageresize.php` will be available in your Laravel `app/config` folder. See this file for more details.

## How does it work
Let's assume you have an image in /public/media/images/test.jpg and a template called 'thumbnail'. And have set the imageresize.route config to 'media/resized'.
Referring to /media/resized/thumbnail/images/test.jpg will trigger the imageresize route in laravel since the file doesn't exist. Imageresize then creates the resized image and saves it as /public/media/resized/thumbnail/images/test.jpg
So the next time you refer to /media/resized/thumbnail/images/test.jpg the file does exist and the image is served without triggering any php/laravel code for optimal performance.
Let's assume you have an image in `/public/media/images/test.jpg` and a template called `thumbnail`. And have set the imageresize.route config to `media/resized`.

Referring to `http://domain.com/media/resized/thumbnail/images/test.jpg` will trigger the imageresize route in laravel since the file doesn't exist. Imageresize then creates the resized image and saves it as `/public/media/resized/thumbnail/images/test.jpg`.

So the next time you refer to `http://domain.com/media/resized/thumbnail/images/test.jpg` the file does exist and the image is served without triggering any php/laravel code for optimal performance.

## Drawbacks
There is however one disadvantage: if the original image is edited or removed the resized file will still remain the same since referring to it doesn't trigger the imageresize package. You will have to manually delete it or use the `php artisan imageresize:delete` command.

0 comments on commit ce8975b

Please sign in to comment.