Skip to content
This repository was archived by the owner on Mar 1, 2018. It is now read-only.

Commit ec3cdc1

Browse files
committed
* added max_folder_depth default value 10 and added default options format and sf_format for thumbnail removal
1 parent 7179b80 commit ec3cdc1

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

lib/routing/sfImageTransformRoute.class.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,23 @@
2020
*/
2121
class sfImageTransformRoute extends sfRequestRoute
2222
{
23+
/**
24+
* Constructor.
25+
*
26+
* Applies a default sf_method requirements of GET or HEAD.
27+
*
28+
* @see sfRoute
29+
*/
30+
public function __construct($pattern, $defaults = array(), $requirements = array(), $options = array())
31+
{
32+
if (!isset($options['max_folder_depth']))
33+
{
34+
$options['max_folder_depth'] = 10;
35+
}
36+
37+
parent::__construct($pattern, $defaults, $requirements, $options);
38+
}
39+
2340
/**
2441
* Generates a URL from the given parameters.
2542
*
@@ -153,6 +170,16 @@ public function preassemblePattern($params = array())
153170
{
154171
$params = $this->convertObjectToArray($params);
155172

173+
if(!$params['sf_format'])
174+
{
175+
$params['sf_format'] = '{jpg,gif,png}';
176+
}
177+
178+
if(!$params['format'])
179+
{
180+
$params['format'] = '{'.implode(',', array_keys(sfConfig::get('thumbnailing_formats'))).'}';
181+
}
182+
156183
foreach($params as $key => $value)
157184
{
158185
$this->pattern = str_replace(':'.$key, $value, $this->pattern);

0 commit comments

Comments
 (0)