diff --git a/README.md b/README.md index c3011b1..bec824c 100755 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ To produce a 300x200 thumbnail of this, you would change the path to: This file, of course, doesn't exist yet. Croppa listens for specifically formatted image routes and build this thumbnail on the fly, outputting the image data (with correct headers) to the browser instead of the 404 response. -At the same time, it saves the newly cropped image to the disk in the same location (the "…-300x200.png" path) that you requested. As a result, **all future requests get served directly from the disk**, bybassing PHP and all that overhead. This is a differentiating point compared to other, similar libraries. +At the same time, it saves the newly cropped image to the disk in the same location (the "…-300x200.png" path) that you requested. As a result, **all future requests get served directly from the disk**, bybassing PHP and all that overhead. In other words, **your app *does not boot* just to serve an image**. This is a differentiating point compared to other, similar libraries. Since 4.0, Croppa lets images be stored on remote disks like S3, Dropbox, FTP and more thanks to [Flysystem integration](http://flysystem.thephpleague.com/). @@ -36,7 +36,7 @@ Since 4.0, Croppa lets images be stored on remote disks like S3, Dropbox, FTP an ## Configuration -Read the [source of the config file](https://github.com/BKWLD/croppa/blob/master/src/config/config.php) for documentation of the config options. Here are some examples of common setups. +Read the [source of the config file](https://github.com/BKWLD/croppa/blob/master/src/config/config.php) for documentation of the config options. Here are some examples of common setups: #### Local src and crops directories @@ -51,6 +51,21 @@ return [ ]; ``` +Thus, if you have ``, the returned URL will be `/uploads/file-200x_.jpg`, the source image will be looked for at `public_path().'/uploads/file.jpg'`, and the new crop will be created at `public_path().'/uploads/file-200x_.jpg'`. And because the URL generated by `Croppa::url()` points to the location where the crop was created, the web server (Apache, etc) will directly serve it on the next request (your app won't boot just to serve an image). + +Here is another example: + +```php +return [ + 'src_dir' => '/www/public/assets/images', + 'crops_dir' => '/www/public/assets/images/crops', + 'path' => 'images/(.*)$', +]; +``` + +If you have ``, the returned URL will be `http://domain.com/assets/images/crops/file-200x100.jpg`, the source image will be looked for at `/www/public/assets/images/file.jpg`, and the new crop will be created at `/www/public/assets/images/crops/file-200x100.jpg`. + + #### Src images on S3, local crops This is a good solution for a load balanced enviornment. Each app server will end up with it's own cache of cropped images, so there is some wasted space. But the web server (Apache, etc) can still serve the crops directly on subsequent crop requests. @@ -71,6 +86,8 @@ return [ ]; ``` +Thus, if you have ``, the returned URL will be `/uploads/file-200x100.jpg`, the source image will be looked for immediately within the S3 bucket that was configured as part of the Flysystem instance, and the new crop will be created at `/uploads/file-200x100.jpg`. + ## Usage @@ -154,6 +171,8 @@ Run `php artisan bundle:publish croppa` to have Laravel copy the JS to your publ -## Thanks +## History + +Read the Github [project releases](https://github.com/BKWLD/croppa/releases) for release notes. This bundle uses [PHPThumb](https://github.com/masterexploder/PHPThumb) to do all the [image resizing](https://github.com/masterexploder/PHPThumb/wiki/Basic-Usage). "Crop" is equivalent to it's adaptiveResize() and "resize" is … resize(). Support for interacting with non-local disks provided by [Flysystem](http://flysystem.thephpleague.com/).