dotblue / nette-webimages

On-the-fly generated web images for your Nette app
Other
26 stars 18 forks source link

Plug-in support / call only specified providers (proposal) #24

Open Koricz opened 9 years ago

Koricz commented 9 years ago

Hi,

I will in near future make a local QR code image generator and don't want make It as separate add-on but as a plug-in to nette-webimages which I already using.

It can't be done now in handy way because Providers are called one by one.

All what is needed, I think, is to add some property e.g. $types to Generator with some default $type for current providers (eg. 'image') and extend Iprovider interface with e.g. getType() which is a small BC break.

Generator will then call only specified providers by given type.

Plug-in should work with same n:src macro and like any other image provider with new (optional) $type parameter what providers(s) should be call.

It can be done now by passing and additional argument to n:src macro, but the all providers must be altered to check that parameter and then do something...

This change should be also handy if I want to call only some providers on given image.

What do you think?