added image rotation for jpegs
fixed image scaling after rotate