Bugfix image resizer

PS: the comments are explanations about what I've done. This is my first PR, so I dont knew how that works