Thanks buddy.. This is exactly I was looking for.. It worked.
This is a good functionality but might be confusing for new user. Because everyone thinks that image can only be displayed if you insert it.
Furthermore, if we choose image from already uploaded in media then it does not display correct?