<?php 
$im=new thumbnail_tool(CHEMIN,CACHE_VIGNETTES,APP."images/");
$im->set_source(IMPORTS_URL.$item->getFile('illustration'));
$de=$item->getDescription('illustration');
?>

<div id="fw" class="py-5 px-3">
    <div id="fw-visual">
        <div id="fw-image">
            <img src="<?= $im->vignette(FULLSIZE_W,FULLSIZE_H,false); ?>" alt="<?= $de ?>">
            <div class="fw-nav fw-prev" onclick="yc_vieweshowimage(-1)"></div>
            <div class="fw-nav fw-next" onclick="yc_vieweshowimage(1)"></div>
            <div class="fw-description ff-bold-secondary fs-small"><?php
    if($de){
        echo "<span>".$de."</span>";
    }
                ?></div>
        </div>
    </div>
    <div id="fw-infos" class='mt-3 mx-md-5 container' >
                <div class='item-content-gallery flex justify-content-center flex-gap-2'>
                    <?php    
    $supported_image = array('gif','jpg','jpeg','png','webp');

            foreach($item->getFileList() as $file){

                $ext = strtolower(pathinfo(IMPORTS_URL.$file['file'], PATHINFO_EXTENSION));
                if (in_array($ext, $supported_image)) {
                    echo "<div class=''>";
                    echo "<img onclick=\"yc_vieweshowclickimage(this)\" data-slideshow data-slideshowsrc=\"";
                    $im->set_source(IMPORTS_URL.$file['file']); 
                    echo $im->vignette(FULLSIZE_W,FULLSIZE_H,false);
                    echo "\" src=\"".$im->vignette(60,60,true)
                        ."\" class=\"item-gal img-object-fit aspectratio-1 \" title=\"".$file['description']."\">";
                    echo "<div class='fs-tiny ff-bold-secondary' data-description>".$file['description']."</div>";
                    echo "</div>";
                } 
            }
                    ?>
                </div>
            </div>
    
    <div  class="p-3 text-viewer">

        <h2 class="fs-big ff-bold-primary mb-2 text-center border-top pt-3"><?= $item->get('titre') ?></h2>
        <div class="fs-regular item-info pb-3 pt-2 text-center border-bottom ">
            <span class="item-techspecs"><?= $item->get("techspecs") ?></span> —  
            <span class="item-date_oeuvre" ><?= formate_date($item->get("date_oeuvre"),"year") ?></span>
        </div>

        <div class="item-info item-texte fs-medium ff-secondary mt-4">
            <?= $item->get("texte") ?>
        </div>

        <div>
            
        </div>
        <div class="mt-3">
            <?php
            if($item->get("lien",false)){
                $parts=parse_url($item->get("lien"));
                echo "Lien vers <a href=\"".$item->get("lien")."\">".$parts['host']."</a>";

            }
            ?>
        </div>

        <?php
        foreach(MODULES['insert_item'] as $insert){
            include(CHEMIN.$insert);
        }
        ?>
    </div>
</div>