Zola can't find file even though it is there

I have an art portfolio section which uses a template with this for each page:

{% set lossy_image = resize_image(path=current_url ~ "lossless.webp", format="webp", quality=90 ) %}
<a href="{{ current_url }}lossless.webp" target="_blank">
    <img src="{{ lossy_image.url }}" />

Each page has a lossless.webp file in it’s directory. Still, zola days this when building:

Failed to build the site
Error: Failed to render page '/git-repos/papojari.codeberg.page/content/art/City block/index.md'
Reason: Failed to render 'art-page.html'
Reason: Function call 'resize_image' failed
Reason: `resize_image`: Cannot find file:

even though there is an image at What am I doing wrong here? The plan is to only store lossless images in my source code and have them be converted to a lossy image with zola for the website.

The resize_image calls need to point to the image on disk, not the webserver.

How do I do that within the Tera expression though?

You can use
{% set lossy_image = resize_image(path=page.path ~ "lossless.webp", format="webp", quality=90 ) %}

Now I get

Building site...
Checking all internal links with anchors.
> Successfully checked 0 internal link(s) with anchors.
-> Creating 18 pages (0 orphan), 2 sections, and processing 0 images
Error: Failed to render page '/home/papojari/projects/papojari.codeberg.page/content/art/city-block/index.md'
Reason: Failed to render 'art-page.html'
Reason: Function call 'resize_image' failed
Reason: `resize_image`: Failed to read image: /home/papojari/projects/papojari.codeberg.page/content/art/city-block/lossless.webp

even though the file is there.

Are the permissions of the file ok? Is it readable by Zola?

Yes it should be fine. I mean all the other files are able to be read too.

The permission is rw-r–r–

I still haven’t found at how to do it with zola but I’m using a build system now that generates the lossy images.

Do you have the repo public so I can see why it’s not picking up the image?

The repo is at https://codeberg.org/papojari/papojari.codeberg.page. The resize call is in templates/art-page.html.

Do you have a specific commit? There are no calls in the template right now

Edit: ah wait i see the files, I’ll try it directly

The following works:

        <p class="images">
            {% set lossy_image = resize_image(path=page.assets[0], format="webp", quality=90, width=240, height=240) %}
            <a href="lossless.webp">
              <img src="{{ lossy_image.url }}">
              lossless image

We don’t have a operation to just lower the quality, so if you want to keep the same size as the original, you will need to call Overview | Zola first and pass the result as arguments to resize_image.