Add image rotation support for thumbnails