You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the image()-function returns an error, if the specified image is not found. This makes it difficult to make templates, which include certain images, but which are only available later on.
The image function should include a "placeholder" property, which takes a content as parameter, which is rendered only if the image is not found at the specified path.
The syntax should be as follows:
image("path/to/image.png", width: 100%, placeholder: [Make sure to add an image before submission.])
Use Case
Users would be able to create documents and templates, where the document itself does not need to be modified to add an image to it. An image file only needs to be placed in the corresponding path for it to be rendered.
Otherwise, lacking an image file would mean the document fails to compile, rather than to display a placeholder.
Reacted by Philipp Niedermayer, drskoolie, ⑆ Neved4 ⑈, Pavel Zwerschke, Leo Tietz, Lukas Mandok, Roy Francis, Adrian Vollmer, Neven Villani, pfroud-dpc and 1 more
If we really were to implement this, I would prefer a separate function that checks whether a file exists,
with which you can then make your own wrapper to image.
I'm not sure whether it's even a good idea tho. Making document output filesystem-dependent feels kind of wrong to me.
Activity
ondohotola commentedon Aug 8, 2023
I do something like
T0mstone commentedon Aug 26, 2023
If we really were to implement this, I would prefer a separate function that checks whether a file exists,
with which you can then make your own wrapper to
image.I'm not sure whether it's even a good idea tho. Making document output filesystem-dependent feels kind of wrong to me.
laurmaedje commentedon Jul 15, 2024
Closing in favor of #2025