Created
May 25, 2016 18:28
-
-
Save grobertson/1b5aa0e4834b59b375efc6aa8fa705b9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_width(self, width): | |
"""Returns an acceptable width from a requested width. | |
Per https://developers.facebook.com/docs/plugins/embedded-posts/, FB | |
embeds must be between 350 and 750 pixels wide. | |
If no width passed, default to 360, else get as close to requested | |
width as possible while following FB's guidelines. | |
""" | |
if not width: | |
width = 585 | |
elif width > 750: | |
width = 750 | |
elif width < 350: | |
width = 350 | |
return width |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment