imagecache
imagecache copied to clipboard
Added possibility to define Templates with arguments
Hi,
I added what I believe is a simple yet very helpful trick. But I obviously may not see the entire picture.
That would fully resolve issues like this one: https://github.com/Intervention/image/issues/368
And would still hold the security argument: https://github.com/Intervention/image/issues/241
See basic example:
'templates' => array(
'small' => 'Intervention\Image\Templates\Small',
'medium' => 'Intervention\Image\Templates\Medium',
'large' => 'Intervention\Image\Templates\Large'
)
Would become:
use Intervention\Image\Templates\Fit;
'templates' => array(
'small' => [Fit::class, 120, 90],
'medium' => [Fit::class, 240, 180],
'large' => [Fit::class, 480, 360]
)
And would allow easy customisation.
What are your thoughts?
Does it make sense?
The problem I was facing is that I had to create a new Template for every different parameters combination of a given image transformation (which is exactly the problem of the documentation example: small, medium, large are all the same transformation).
Up.