static function updateThumbnail($fname, $w, $h, $quality = 25) { $thumbDir = dirname($fname) . '/.thumbs/'; $thumbFname = $thumbDir . basename($fname); $doUpdate = @filectime($fname) > @filectime($thumbFname); if ($doUpdate) { // create thumbs dir if (!file_exists($thumbDir)) { @mkdir($thumbDir); } // save thumbnail $img = new img($fname); $img->resize($w, $h); file_put_contents($thumbFname, $img->render($quality)); } return $thumbFname; }