Rather than assuming consent, or requesting it on a short timeframe right as the exam starts, the professor should get consent this way:
In the first or second lecture, show a series of pictures from previous years, including the memed ones. Further, explain where these go (public blog or twitter? private facebook page for students in this class this year? The physical wall outside the profs office?) Then say "if you're cool with being the subject of one of these pictures, please [email me and say so, or put your name on this list at the front, or go to this web page and enter your student id, or something relatively unspoofable.]
The onus is now on the prof to ensure that pictures are taken and cropped so that they only include students known to have agreed to this. (Don't recognize third-from-the-left? Can't remember if that's Ashleigh or Ashley? Not a usable picture.)
At most one reminder later in the term for new arrivals would be ok. Other than that, there shouldn't be any haranguing like "7 people still haven't filled out the ok-to-make-a-meme-of-me form, please try to get that done today."
Approaching this any other way at best risks leaving some students unhappy and feeling mocked; depending on where you live it could have worse outcomes including legal and financial liabilities. There is no upside to assuming consent and saying it's all for fun. The prof and students are spending 4 or 8 months together, there is plenty of time to collect non pressured optional true consent if this really is so much fun.
In addition, a role model showing people that "hey, this is fun, don't be a spoilsport, just go along" is no longer the way universities operate will be doing a larger public service for those who will hear the same words around alcohol, drugs, vandalism, coerced sex, and the like. Just because something will be fun for some of the people participating in it, that doesn't mean everyone should participate regardless of their feelings or preferences. Demonstrating that with something relatively minor like pictures of funny faces during exams is probably a really good life lesson. True consent matters.