Get image data for lightbox?


#1

Hello everyone. I’m new to Pimcore. Looks awesome and great. But I have a question and can not find it the the documentatin. I made a editable for an image (image1). The image is located in the asset manager in a seperate folder. now, the markup has a lightox. how can i make a relation to the image the user is uploading?

                            <div class="dummy-lightbox-clicky">
                                <?= $this->image("image1"); ?>
                                <div class="thumb-left">
                                    <a class="zoom" href=".... this should point to (image1) path.....</a>
                                </div>
                            </div>

thank you very much!
sandra


#2

Hi,

you need to store the image in an variable and reuse it, something like this. (note: the code is not tested ;))

<?php $image = $this->image("image1"); ?>

<?php
if ($this->editmode) {
    echo $image;
}

if ($image->getImage() instanceof \Pimcore\Model\Asset\Image) {
    ?>
    
    <div class="thumb-left">
        <a class="zoom" href="<?=$image->getImage()->getThumbnail('lightbox')?>"></a>
    </div>
    
    <?php
        
    }
?>

#3

Got it done. Thanks!