/** * Cache this post */ private function cache() { // Read files $files = $this->dir_to_array(POSTS_DIRECTORY . DIRECTORY_SEPARATOR . $this->name, true, true, true); $cache_dir = WEBROOT_DIRECTORY . DIRECTORY_SEPARATOR . $this->name; @mkdir($cache_dir); foreach ($files as $key => $value) { $filename = pathinfo($value, PATHINFO_FILENAME); // Resample JPG files $ext = strtolower(pathinfo($files[$key], PATHINFO_EXTENSION)); if ($ext == 'jpg' || ($ext = 'jpeg')) { ImageHelper::resample($value, $cache_dir . DIRECTORY_SEPARATOR . $filename . "." . $ext, DEFAULT_IMG_WIDTH); } } }