<?php
include_once ('../../../config.php');
include_once ("../path.php");
include_once ("helpers.php");

$folders = scandir($json_instance_path);

echo "<div style='$SCRIPT_STYLE'>";
echo "Click on a model to REMOVE its preview image file <br><br>";

$i = 0;
foreach ($folders as $f)
{
    $path = $json_instance_path . $f;
    $object = $path .'/'. $preview_file;
    
    if ($f === '.' || $f === '..' || !is_dir($path)) continue;

    if(is_file($object)) 
    {
        remove_button($object); //helpers function
        $i++;
    }

}

if ($i === 0) echo 'No model with a preview image available';

echo '</div>';

