Hello! Thanks for reading this post, I’ll try to be as brief as possible.
The purpose of the pack I’m trying to build is really simple: Ingest an image from a URL, so that it’s stored locally in the document and always available. The source images will always come from the same domain.
Following the documentation I’ve close to this result, but not quite there. For some reason the Result of the Action only displays the image if the column is type: Text. Otherwise it shows nothing. And if I copy the cell containing the displayed image, and paste it elsewhere in the doc, it follows this structure:
Has anyone had success with this type of thing, do you know what I’m missing? I’ve seen some packs that seem to have successfully done this, like the Documint Pack, but of course it’s not open source so I can’t check how they did it.
Hi @Emi_Jimenez - Welcome to the Coda community! In a Pack there are two ways to reference images:
ImageReference or ImageAttachment . When using an image reference the image is always loaded from the source URL, while for attachments Coda copies the image from the source URL into the document and shows that local copy.
Source: Working with images and files - Coda Pack SDK
So ImageAttachment is what you want, but there’s a limitation:
You actually don’t need to even use or create a pack to ingest a URL and store it locally in Coda.
As long as you have the hosted image url you can simply push it into an an image/file type column and Coda will automatically fetch the image, host it on their servers, thus storing it locally in a table
For example, if you catch a webhook with an image URL in a payload and pass its results to a file type or image column, Coda will do all the work for you.
That’s how documint does it. Simply returns an Amazon url into a coda file type column which converts and stores the new pdf locally.
As I said, you dot. Even need a pack. You could just use a Coda ModifyRows() button to push a string url into a file type column and Coda will fetch the file/image stored elsewhere and store it locally.
Scott, I’ve tested what you said, and it works! Thank you very much!! By the way, are you associated with Documint in any way? We are probably going to implement some sort of document automation in my team, and I’ve already made an account with them (I found them because of your pack). Let me know if there’s some sort of referral code or sth so that you can monetize my usage.
Eric, thanks for your feedback as well. Since Scott’s solution would make my simple use-case work with just a Coda formula, I wouldn’t want to use your valuable time down this path. I’m probably gonna come back here asking something similar for a future project I want to make, but it’s probably gonna be for quite a while before I can start it, and I’ve already bookmarked a community post where you’ve helped someone do something similar, so I’ll inspect that thoroughly first, before I come bothering again. Thanks!!!