You could move this after function `resizedImg` declared.