The central clue is that you describe yourself as a novice. The articles are telling you how to do it. A novice should learn their language of choice, not try to write a cutting edge app.
Having said that, this
] article describes what you need, I think. I would cache the thumbnails, not generate them at the point of demand.