// file exists print viewer if (!file_exists('small')) { mkdir('small', 0777, true); } if(file_exists('./data.txt')) { //print viewer // get content from data.txt $fileData=file_get_contents("./data.txt"); //explode data with breaks $arrayOfNames=array_filter(explode("\n", $fileData)); $panCount = 0; if(!file_exists('small/thumbs.txt')) { for ($i=0; $i < count($arrayOfNames); ++$i) { $panCount++; $filename= substr($arrayOfNames[$i],-36); $width = 300; $height = 300; list($width_orig, $height_orig) = getimagesize($filename); $ratio_orig = $width_orig/$height_orig; if ($width/$height > $ratio_orig) { $width = $height*$ratio_orig; } else { $height = $width/$ratio_orig; } // $itName=array_filter(explode(" | ", $arrayOfNames[$i])); $image_p = imagecreatetruecolor($width, $height); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width_orig, $height_orig); imagejpeg($image_p, "small/".$filename, 90); $fp = fopen('small/thumbs.txt', 'a'); } } ?>