servdhost / craft-asset-storage

MIT License
10 stars 1 forks source link

Ability to transform external images if using servd as both storage and transformer? #70

Open zhua89cc opened 1 year ago

zhua89cc commented 1 year ago

Question/Enhancement:

We are using servd both as a hosting service and asset management for a new craft site we are building. We have an entry type that pulls in videos from youtube and are using imager x to transform both the image on the entry type but as a fallback if the entry doesn't haven image we are getting the Youtube thumbnail and using that as a fallback. I read in the docs that if we're using servd as our transformer it will only work for images stores on the servd assets platform so in this case trying to transform any external image urls are returning null. We use a shared component library across sites so in our image twig template it isn't expecting the craft.imagerx.transform method to really return null. Is there a workaround or potential added feature of being able to transform external images down the pipeline anytime soon?

Here's our imager-x.php config

`$config = [ 'transformer' => 'servd', 'fallbackImage' => 'https://s3.amazonaws.com/uschamber.com-assets/assets/images/generic-missing_2020-12-10-141105.gif', 'cacheRemoteFiles' => true, 'cacheDuration' => 1209600, 'cacheDurationRemoteFiles' => 1209600, 'cacheDurationExternalStorage' => 1209600, ];

return $config;`

Craft Version: 4.5.1 Servd Asset Storage: 3.4.10

mattgrayisok commented 9 months ago

Although Servd's image transformer can't pull images in from external sources, it would be better for our transformer to fall back to Craft's default transform mechanism when presented with a URL it can't handle to see if that can do it instead.

I'll see if we can drop that in in a way that also works ok with Imager et al.