feat($scaling): fixed thumbnail generation, refactor of some file handling logic required #1061