# How to generate dynamic background image for section?

**URL:** <https://forum.bricksbuilder.io/t/how-to-generate-dynamic-background-image-for-section/15321>\
**Category:** How To\
**Tags:** how-to\
**Created:** [September 12, 2023, 7:40pm UTC](https://forum.bricksbuilder.io/t/how-to-generate-dynamic-background-image-for-section/15321 "2023-09-12T19:40:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SeanB](https://forum.bricksbuilder.io/user_avatar/forum.bricksbuilder.io/seanb/32/2242_2.png) [@SeanB](https://forum.bricksbuilder.io/u/SeanB)\
**Post date:** [September 12, 2023, 7:40pm UTC](https://forum.bricksbuilder.io/t/how-to-generate-dynamic-background-image-for-section/15321/1 "2023-09-12T19:40:12Z")

</div>

Hi,

I’m not sure if this is a bug or just something that I’m not doing correctly. I’m trying to generate the background image for a section based on a meta field in my CPT. My CPT is called ‘Movies’ (from the TMDB API) and it has a meta field called `backdrop_path`. Now the data I get for the API for all movies only has the path, e.g. ‘ **/2vFuG6bWGyQUzYS9d69E5l85nIz.jpg** ’ so in order to generate the full URL this path needs to be prefixed with **[https://image.tmdb.org/t/p/original](https://image.tmdb.org/t/p/original)**.

I set the background of a section for the Single Movie Post Template to be and Output PHP function.

```auto
<?php 

function backdrop_url( $backdrop_path ){
    $backdrop_url = 'https://image.tmdb.org/t/p/original' . $backdrop_path;
    return $backdrop_url;
}

```

 ![image](https://forum.bricksbuilder.io/uploads/default/original/2X/d/d0ca1a2cb8e582866d82aafb65e45aa3167a9862.png)

I’m using JetEngine for my CPT and the meta field for the backdrop\_path is called `je_movies_backdrop_path`

…but nothing happens. The image is not rendered. I tried this for a section, a container, block, and div element and in no case is the image being generated.

Strangely, if I use a text element and set the content to be dynamic using the Output PHP function and use the same expression `{echo:backdrop_url('{je_movies_backdrop_path}')}`, the text is rendered on the page and I can also set the text to link to this URL and it opens the backdrop image in a new tab confirming that this is a valid image.

Am I doing something wrong here or is this a bug?

Thank you.
