Fit dimensions of resizable image