Template variable default image not display

MacOS : 15.1
Modx 3.0.3
MAMP Pro : 6.9.1
PHP : 7.3.33
Babel : 3.4.0

I am designing a website for a cannabis nursery. For the resources “genetic” I created several template variables, including one of type image that contains the image the path for the photo of the genetics that I named “photo-genetic”

General information
TV Name : photo-genetic

Input options
Input type : Image
Default Image : assets/images/genetics/genetic-by-default.jpg
Allow Blank : Yes

Output options
Output Type : Text

Template Access :
Template : genetic-data

Media Sources
web (french) - Filesystem
english - Filesystem

No problem to display the image of the genetics when I enter the path of the genetics in the variable «photo-genetic».

But when I leave the template variable «photo-genetic» empty, the default image does not appear.

Code in my template model

<figure>
        <picture>
            <source srcset="[[*photo-genetic:replace=`jpg==webp`]]" type="image/webp" />
            <source srcset="[[*photo-genetic]]" type="image/jpeg" />
            <img src="[[*photo-genetic]]" alt="[[*photo-genetic-alt]]" class="genetic-image" width="3600" height="2745" loading="eager" decoding="async"
            />
        </picture>
</figure>

Code when the page is rendered on the screen, when a value is assigned to TV «photo-genetic»

<figure>
        <picture>
            <source srcset="assets/images/genetics/animal-mints.webp" type="image/webp">
            <source srcset="assets/images/genetics/animal-mints.jpg" type="image/jpeg">
            <img src="assets/images/genetics/animal-mints.jpg" alt="Cannabis plant Animal Mints" class="genetic-image" width="3600" height="2745" loading="eager" decoding="async">
        </picture>
</figure>

Code when the page is rendered on the screen, when TV “photo-genetic” is empty.


<figure">
        <picture>
            <source srcset type="image/webp">
            <source srcset type="image/jpeg">
            <img src alt class="genetic-image" width="3600" height="2745" loading="eager" decoding="async">
        </picture>
</figure>

Could someone generous enough point out to me where I am going wrong?

Thanks in advance for your help.

There is a difference between an empty value (which is allowed → Allow Blank : Yes) and the default value.

I think it should work if you use the “set to default” button instead (see image):
set_to_default


That said, you might want to instead use an output modifier in your template to make sure there’s always a value:

[[*photo-genetic:default=`assets/images/genetics/genetic-by-default.jpg`]]