function __construct()
 {
     $list = glob(Instagram::CACHEFOLDER . "*.json");
     $oldCount = count($list);
     $ignoreList = array();
     if (file_exists(".DEV")) {
         $oldCount = 0;
     }
     if (file_exists(".IGNORE")) {
         $tmp = trim(file_get_contents(".IGNORE"));
         $tmp2 = explode("\n", $tmp);
         foreach ($tmp2 as $ignore) {
             $ignore = trim($ignore);
             if (!empty($ignore)) {
                 $ignoreList[] = $ignore;
             }
         }
     }
     $i = new Instagram();
     $i->fetchJSON()->parse($ignoreList);
     $rsscontent = file_get_contents("tpl/rss.tpl");
     $feeditems = "";
     $list = glob(Instagram::CACHEFOLDER . "*.json");
     if ($oldCount != count($list)) {
         $nodes = array();
         foreach ($list as $fn) {
             $n = json_decode(file_get_contents($fn));
             if (isset($n->code) && isset($n->date)) {
                 $nodes[] = $n;
             }
         }
         usort($nodes, function ($a, $b) {
             return (double) $a->date != (double) $b->date ? (double) $a->date > (double) $b->date ? -1 : 1 : 0;
         });
         $template = file_get_contents('tpl/front.tpl');
         $btemplate = file_get_contents('tpl/block.tpl');
         $blocks = "";
         foreach ($nodes as $node) {
             if (in_array($node->code, $ignoreList)) {
                 continue;
             }
             $block = $btemplate;
             $block = str_replace("{IMAGE}", "data/" . $node->code . "_320.jpg", $block);
             $block = str_replace("{CAPTION}", $node->caption, $block);
             $block = str_replace("{CODE}", $node->code, $block);
             $block = str_replace("{LIKES}", $node->likes->count, $block);
             $block = str_replace("{LIKESSTRING}", $node->likes->count > 0 ? "<span style='color: #FF0000;'>{$node->likes->count} &#9829;</span> " : "", $block);
             $bwidth = 320;
             $bheight = 320;
             if (!file_exists("data/" . $node->code . "_320.jpg")) {
                 `/usr/bin/convert -strip -filter Lanczos -interlace Plane -sampling-factor 4:2:0 -define jpeg:dct-method=float -quality 85% -geometry 320x www/data/{$node->code}.jpg www/data/{$node->code}_320.jpg`;
             }
             list($width, $height, $type, $attr) = getimagesize("www/data/{$node->code}_320.jpg");
             $bheight = $height;
             $block = str_replace("{WIDTH}", $width, $block);
             $block = str_replace("{HEIGHT}", $height, $block);
             $blocks .= $block;
             $feeditems .= "<item>\n    <title>" . $node->code . "</title>\n    <link>http://brandtrapselfie.nl/data/" . $node->code . ".jpg</link>\n    <description>" . $node->caption . "</description>\n    <enclosure url='http://brandtrapselfie.nl/data/" . $node->code . ".jpg' type='image/jpeg' />\n  </item>";
         }
         $template = str_replace('{BLOCKS}', $blocks, $template);
         $template = str_replace("{TAGMANAGERS}", file_get_contents(".tagmanagers"), $template);
         $rsscontent = str_replace("{FEEDITEMS}", $feeditems, $rsscontent);
         file_put_contents('www/index.html', $template);
         file_put_contents('www/feed.rss', $rsscontent);
     }
 }