Mass media (and the images that it transmits to us) is not the only agent of gender socialization. We are socialized in this way by our families and our peers as well. However, the mass media does act as an agent of gender socialization because the images it shows us help to teach us what society expects from people of our sex.
When we consume media, we see images from at least three sources that socialize us in terms of gender. We see images in advertising, in entertainment, and in the news.
In advertising, we are often exposed to images that tell us what an ideal man or woman should be. Although these images have changed to some degree over the years, we still see many images that tell us that the value of women is based on their looks or on their ability to be mothers. We see images that tell us that men are supposed to be tough and in charge.
In entertainment, we see many portrayals of men and women in a variety of situations. All of them tell us what men and women are supposed to be like (or not supposed to be like). This is true even in shows where the main characters are not presented as heroes. We still see all sorts of male-female interactions and we see men and women handling different sorts of situations. All of this tells us something about what society expects from us.
Finally, we are socialized by images from the news. Here, we learn something about what men and women do in the real world. This is one place where the images have changed the most. Once, all of the images from the news were masculine. Now, we see much more of women playing a variety of roles in our society.