Express Entry Detail Block - Show Images instead of URL

So I’m trying to get the Express Entry Detail block to show some basic stuff, then I’m going to style it with CSS. The part I’m stuck with is that when an Image Attribute type value is shown (example, logo) it shows the name of the file and is hyperlinked to the file URL. I want to instead show the image itself right there rendered on the page.

This is what I have so far, cobbled together from a few old forum posts, but it’s not working. Can’t quite see why.

Can anyone point me to what I should do here? Thanks!:

<?php defined('C5_EXECUTE') or die(_("Access Denied.")); ?>
<?php
 
if (isset($renderer) && isset($entry) && is_object($entry)) { 
         $photoFileObject = $entry->getImg();
            if (is_object($photoFileObject)) {
                $photoFileObjectVersion = $photoFileObject->getVersion();
                $photoRelativePath = $photoFileObjectVersion->getURL();
            }
    ?>
    <img src="<?php echo $photoRelativePath; ?>" width="100%">
<?php } ?>

Try using the following instead

->src

And using that specifically where? I need more detail please.

Try replacing

            $photoRelativePath = $photoFileObjectVersion->getURL()

With

            $photoRelativePath = $photoFileObjectVersion->src

Okay just tried that, and the image does not display (plus all other elements from the Entry don’t show either, and I’m not sure how to fix that part either lol).

Alright so thanks to @MrKDilkington 's legendary constant stream of help, and this post of his, I found a solution : Express Details Block - concrete5

I took the “player” custom template from the attachment example he made in that thread (BTW THANKS @MrKDilkington !!!) and came up with this:

<?php
if ($entry->getEventBanner()) {
    echo sprintf('<img src="%s">', $entry->getEventBanner()->getRelativePath());
    /* <img src="<?php echo $banner; ?>" width="100%"> */
} else {
    // some kinda alternative that isn't required
}
?>

The “getEventBanner()” is based on the Attribute for the Express Object with the handle “event_banner”, which is an Image type Attribute. And so far this works exactly how I want it! Yay! Hope this helps someone else! :smiley: Thanks to @TMDesigns for your attempts too :slight_smile: