ipython/ipython — pull request #2231 by Carreau (2012-08-01 14:30:25+00:00)
Title: Improve Image format validation and add html width,height

merge #2178 , #2219 , #2226 in one PR.

by cherry-picking the commit of #2226 on top of #2219

--------

This addresses the first two bullets of #2053
Validates first argument to constrain format to png, jpeg,
Lets user specify width, height, or both and emits appropriate html

I introduced a couple of class constants to minimize the number of times I saw 'jpeg' and 'png'
and document the _ACCEPTABLE_FORMATS.

I added one real jpeg image to the test directory and one zero-length gif file to survive the file not found
error in super()

Thanks, Min, for the coaching, I hope it looks adequate.

Closes #2053