Search code examples
htmlcssdjangooembeddjango-oembed

Manipulating oembeds in django


I'm using the django-oembed app to embed (among other content) some flickr photos: Using this:

 {% oembed %} http://www.flickr.com/photos/majdal/3866163776/ {% endoembed %} 

will return this:

<img alt="Basilica di San Giorgio Maggiore" src="http://farm3.static.flickr.com/2429/3866163776_3e63cc9b49.jpg">

This is excellent, except that I need to add a rounded corner mask to the photo. I know I can do that if the image was a background to a , but that's not possible with the output of the {% oembed %} tag. Any ideas on what else could work?

Thanks!


Solution

  • You could wrap the oembed tag result with a DIV element and apply styles to that:

    <style type="text/css">
        div.oembed img {
            border: #fafafa 3px solid;
            border-radius: 3px;
        }
    </style>
    
    <div class="oembed">
        {% oembed %}  {{ image_url }} {% endoembed %}
    </div>