You can try to take an example of code from OOB application. The schema name is BaseMessageHistoryItemPage that is placed in the Message package. The functionality is developed for the Case page and works in the following way - you just click on the picture that is placed in the Email or Portal message to enlarge it.