Fix file name on generate thumbnails

Fix file name for thumbnails
If we use file names:
photo.1.jpg
photo.2.jpg
photo.3.jpg

all thumbnails will be "photo.jpg"