Updated code for checking if https is used in the media URL.