# Resize images from a shortcode

**URL:** <https://zola.discourse.group/t/resize-images-from-a-shortcode/1583>\
**Category:** Uncategorized\
**Created:** [January 2, 2023, 1:58am UTC](https://zola.discourse.group/t/resize-images-from-a-shortcode/1583 "2023-01-02T01:58:46Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![LunarEclipse](https://yyz2.discourse-cdn.com/free1/user_avatar/zola.discourse.group/lunareclipse/32/1216_2.png) [@LunarEclipse](https://zola.discourse.group/u/LunarEclipse)\
**Post date:** [May 18, 2024, 10:31pm UTC](https://zola.discourse.group/t/resize-images-from-a-shortcode/1583/3 "2024-05-18T22:31:47Z")

</div>

So basically, the problem is that `resize_image` cannot find your image because it’s not getting the full path.

The solution (that doesn’t involve manually writing in the full path into the shortcode) is to do something like this in the shorcode:

```auto
{% set document = page | default(value=section) -%} {# this ensures the shortcode works in both pages and sections -#}
{% set image1 = resize_image(path=document.colocated_path ~ receivedurl, height=250, format="webp") -%}

```

Essentially, `page.colocated_path` or `section.colocated_path` contain the path to where the colocated assets are for the page you’re currently processing, and you need to prepend the `receivedurl` with that path.

---

_[View the full topic](https://zola.discourse.group/t/resize-images-from-a-shortcode/1583)._
