Skip to content

Conversation

@danielhedinn
Copy link

Adds optional configuration field where you can pass function that is run before the image is rendered.
An example of the use case of this is if images are uploaded to private s3 buckets (or other places where a signed url is needed to retreive the image).
The "identifier" of the image can be passed as additional data with the url and the pre-render hook can update the signed url.

this PR also closes #241.

Add pre-render hook
@neSpecc
Copy link
Contributor

neSpecc commented Mar 21, 2025

Take a look at this PR: #253
It was designed to handle custom image resolving. What do you think?

@danielhedinn
Copy link
Author

I will say I'm rather new to ts development, so I may know about potential best/worst practices related to this matter - And I may be biased.
#253 looks really good and seems to be well documented, but may also have limitations, since the "resolver" function is limited to outputting a string which is directly used as an URL. Albeit I cannot think of an example of that being a limitation at the moment.
My idea was to just keep things simple and flexible - but maybe I should turn the pre-render hook into a promise for good measure.

But to be frank, I don't care which implementation you go with, I just want to see this feature in the module :)

@hedinnhf hedinnhf closed this by deleting the head repository May 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warning: appendCallback hook is deprecated

3 participants