Skip to content
This repository has been archived by the owner on Dec 9, 2023. It is now read-only.

Added possibility to define Templates with arguments #62

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Added possibility to define Templates with arguments #62

wants to merge 2 commits into from

Conversation

eightyfive
Copy link

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:
Intervention/image#368

And would still hold the security argument:
Intervention/image#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?

@eightyfive
Copy link
Author

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).

@eightyfive
Copy link
Author

Up.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant