Skip to content

Commit

Permalink
Merge pull request #46 from web-dev/PR-DataRootConfig
Browse files Browse the repository at this point in the history
Added a configuration option for the data root.
  • Loading branch information
lsmith77 committed Jan 17, 2012
2 parents 1a6558c + 13abc89 commit 4b53a7f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public function getConfigTreeBuilder()
->end()
->end()
->scalarNode('web_root')->defaultValue('%kernel.root_dir%/../web')->end()
->scalarNode('data_root')->defaultValue('%liip_imagine.web_root%')->end()
->scalarNode('cache_prefix')->defaultValue('/media/cache')->end()
->scalarNode('cache')->defaultValue('web_path')->end()
->scalarNode('data_loader')->defaultValue('filesystem')->end()
Expand Down
1 change: 1 addition & 0 deletions DependencyInjection/LiipImagineExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ public function load(array $configs, ContainerBuilder $container)
$cachePrefix = $config['cache_prefix'] ? '/'.trim($config['cache_prefix'], '/') : '';
$container->setParameter('liip_imagine.cache_prefix', $cachePrefix);
$container->setParameter('liip_imagine.web_root', $config['web_root']);
$container->setParameter('liip_imagine.data_root', $config['data_root']);
$container->setParameter('liip_imagine.formats', $config['formats']);
$container->setParameter('liip_imagine.cache.resolver.default', $config['cache']);

Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ The default configuration for the bundle looks like this:
``` yaml
liip_imagine:
web_root: %kernel.root_dir%/../web
data_root: %liip_imagine.web_root%
cache_prefix: /media/cache
cache: true
data_loader: ~
Expand All @@ -183,6 +184,11 @@ There are several configuration options available:

default: `%kernel.root_dir%/../web`

- `data_root` - the absolute path to the location that original files should
be sourced from. This option only changes the standard filesystem loader.

default: `%kernel.root_dir%/../web`

- `cache_prefix` - this is also used in the path for image generation, so
as to not clutter your web root with cached images. For example by default,
the images would be written to the `web/media/cache/` directory.
Expand Down
2 changes: 1 addition & 1 deletion Resources/config/imagine.xml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
<tag name="liip_imagine.data.loader" loader="filesystem" />
<argument type="service" id="liip_imagine" />
<argument>%liip_imagine.formats%</argument>
<argument>%liip_imagine.web_root%</argument>
<argument>%liip_imagine.data_root%</argument>
</service>

<!-- Cache resolver -->
Expand Down

0 comments on commit 4b53a7f

Please sign in to comment.