moved image rotation to server side