Add medium/large_media_query, and image handling

For dreamwidth/dw-free#841 and dreamwidth/dw-free#838