<?php
$made_content_f=scandir("made_content");
$made_content_partial_f=scandir("made_content/partial");
$made_content_f=array_splice($made_content_f,2,count($made_content_f));
$made_content_partial_f=array_splice($made_content_partial_f,2,count($made_content_partial_f));
$made_content=[];
$made_content_partial=[];

for($i=0;$i<count($made_content_f);$i++){
    $thumbnail="thumb_".$made_content_f[$i];
    if(!file_exists("made_content/thumbnails/thumb_".$made_content_f[$i])){ 
        $thumbnail="thumb_DEFAULT.jpg";
    }
    $made_content_f[$i]=["made_content/",$made_content_f[$i],$thumbnail];
}
for($i=0;$i<count($made_content_partial_f);$i++){
    $thumbnail="thumb_".$made_content_partial_f[$i];
    if(!file_exists("made_content/thumbnails/thumb_".$made_content_partial_f[$i])){ 
        $thumbnail="thumb_DEFAULT.jpg";
    }
    $made_content_partial_f[$i]=["made_content/partial/",$made_content_partial_f[$i],$thumbnail];
}

if($_GET['type']=="full"){
    echo json_encode(array_merge($made_content_f,$made_content_partial_f));
}
elseif($_GET['type']=="partial"){
    echo json_encode($made_content_partial_f);
} else {
    echo "no type was set";
}
?>
