# How do I reference the resized image and add it to different templates

**URL:** <https://zola.discourse.group/t/how-do-i-reference-the-resized-image-and-add-it-to-different-templates/2369>\
**Category:** Support\
**Created:** [November 11, 2024, 2:36pm UTC](https://zola.discourse.group/t/how-do-i-reference-the-resized-image-and-add-it-to-different-templates/2369 "2024-11-11T14:36:53Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bp7968h](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/bp7968h/32/1352_2.png) [@bp7968h](https://zola.discourse.group/u/bp7968h)\
**Post date:** [November 11, 2024, 2:36pm UTC](https://zola.discourse.group/t/how-do-i-reference-the-resized-image-and-add-it-to-different-templates/2369/1 "2024-11-11T14:36:53Z")

</div>

Hi,

It’s a simple blog site, but I have different partial templates. So what I am trying to do is, In the .md file I have a blog post, I am trying to use a shortcode to resize the image in the blog post.

Now as per the documentations, the output name is hash of the function signature. But now how do I use the same name in the different partial template.

For example:

I have image in post1.md file which is inserted using **shortcode** , and the code for shortcode is as follow and the filename is **resize\_image.html** :

```auto
{% set image = resize_image(path=path, width=520, height=345, op="fit", format="webp") %}
<img
  class = "rounded-lg"
  src="{{ image.url }}"
  alt=alt
  width="{{ image.width }}"
  height="{{ image.height }}"
/>

```

Now we get the url in **image.url** , I got that from the document, now I also need conditionally add the link tag that preloads the image if we are on that page. I have got the below till now, but am having problem with the image link.

I have the following on my **head.html**

```auto
 {% include "injects/preload_blogs_content_images.html" ignore missing %}

```

I have the below in my **preload\_blogs\_content\_images.html**

```auto
{% if current_path and current_path == '/post1/' %}
   <link rel="preload" as="image" href="{{ get_url(path=`?`) }}" />
{% endif %}

```

Now, how do I reference the same image or can we auto do this from the shortcode or any other way we can achieve this.

Really appreciate you help, thank you.

---

<div class="post-metadata">

**Author:** ![matthillco](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/matthillco/32/869_2.png) [@matthillco](https://zola.discourse.group/u/matthillco)\
**Post date:** [December 2, 2024, 8:17pm UTC](https://zola.discourse.group/t/how-do-i-reference-the-resized-image-and-add-it-to-different-templates/2369/2 "2024-12-02T20:17:31Z")

</div>

I don’t think there’s a way to do this. Zola doesn’t really “know” anything about the assets it processes, it’s just a “dumb” converter. And those processed assets are not available until after the page has been processed anyway. So there’s no way to get information about processed assets before they have been processed…
