getThumbnailPath()) and $force) unlink($post->getThumbnailPath()); if (!file_exists($post->getThumbnailPath())) { try { $post->generateThumbnail(); } catch (Exception $e) { echo $e->getMessage(); } } } echo 'Don\'t forget to check access rights.' . PHP_EOL;