resize images and modify js error on firefox