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

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant