# Template function to fetch remote file

**URL:** <https://zola.discourse.group/t/template-function-to-fetch-remote-file/146>\
**Category:** Feature requests\
**Created:** [July 4, 2019, 7:00pm UTC](https://zola.discourse.group/t/template-function-to-fetch-remote-file/146 "2019-07-04T19:00:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![timvisee](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/timvisee/32/73_2.png) [@timvisee](https://zola.discourse.group/u/timvisee)\
**Post date:** [July 4, 2019, 7:00pm UTC](https://zola.discourse.group/t/template-function-to-fetch-remote-file/146/1 "2019-07-04T19:00:08Z")

</div>

I’d like to see a function to use in templates which fetches a remote file.

In my case, I would like to fetch remote thumbnails for YouTube videos. But I can imagine that this is useful as well for other cases

### Semantics

This function could look like this:

```auto
fetch_raw(url="...") -> Url

```

- This is similar to `load_data` , in the sense that it fetches remote data
- This is similar to `resize_image` , in the sense that the command returns an URL for the locally stored file (to `static/processed_images` ) in this case.

Modifying the existing `resize_image` function to support a remote `url` would be an option for me as well.

What are the thoughts on this? Could this be implemented?

_Related GitHub issue: [https://github.com/getzola/zola/issues/738](https://github.com/getzola/zola/issues/738)_

---

<div class="post-metadata">

**Author:** ![keats](https://avatars.discourse-cdn.com/v4/letter/k/34f0e0/32.png) [@keats](https://zola.discourse.group/u/keats)\
**Post date:** [July 4, 2019, 7:40pm UTC](https://zola.discourse.group/t/template-function-to-fetch-remote-file/146/2 "2019-07-04T19:40:46Z")

</div>

> [@timvisee](#):
>
> Modifying the existing `resize_image` function to support a remote `url` would be an option for me as well.

I don’t think that would scale, not everything you want to fetch is going to be an image that you want to resize and even if it is, you might not want to resize it.

Do you know how that’s handled in Hugo/Jekyll etc?

---

<div class="post-metadata">

**Author:** ![timvisee](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/timvisee/32/73_2.png) [@timvisee](https://zola.discourse.group/u/timvisee)\
**Post date:** [July 4, 2019, 8:46pm UTC](https://zola.discourse.group/t/template-function-to-fetch-remote-file/146/3 "2019-07-04T20:46:13Z")

</div>

Yes, a new function for this would be better. Though, the option to resize it as well would be nice, and I don’t think it would be chainable in the current state.

Not sure about Hugo or other static engines. I’ll take a look into it.
