-
Notifications
You must be signed in to change notification settings - Fork 88
4.0 draft spec
Robert Reinhard edited this page Apr 2, 2015
·
12 revisions
-
src_diris the dir where the path is looked for. For me, this is typicallypublic_path().'/uploads'. But, this could potentially beapp_path().'/storage/assets'or a Flysystem instance bound to the IoC container. -
crop_diris where crops are created. For me, this is typicallypublic_path.'/uploads'as well. But, it could bepublic_path.'/uploads'or a Flysystem instance bound to the IoC container. -
whitelistis a callable that allows requests to be rejected.function($path) { // return boolean }
- Asset :
/public/uploads/bar.jpg - Request :
http://domain.com/uploads/bar-200x100.jpg -
src_dir:/public -
crop_dir:/public -
whitelist:function($path) { return preg_match('#^uploads#', $path); }
The whitelist allows the request. The path from the request can be appended to the src_dir to find the asset. A crop is created and stored in the crop_dir at the requested path. On the next request, apache can server that crop directly.
This is the case of #36
- Asset :
/storage/assets/bar.jpg - Request :
http://domain.com/assets/bar-200x100.jpg -
src_dir:/storage -
crop_dir:/public -
whitelist:function($path) { return preg_match('#^assets#', $path); }
Works the same as previous example.
- I don't like that it HAS to be
/storage/assets/bar.jpgand not just/storage/bar.jpg. Maybe I want to introduce aprefixconfig? Or pattern to get the path from the URL. Like maybe I don't use parse_url and have a regex to get the path that can be edited. But, by default, it's everything from the domain up to the query string