Embedding images like on Quora

19 views
Skip to first unread message

Vibhu Rishi

unread,
Jan 6, 2014, 4:18:30 AM1/6/14
to django...@googlegroups.com
Hi,

Is there a way to have images show up by just pasting a url ? 

e.g. on Quora, if i paste a url to an image - http://www.brothersthegame.com/core/media/images/brothers_europe05_big.jpg

it shows up as an image not as a URL. How can I achieve the same using django ? 

Regards,
Vibhu

--
Simplicity is the ultimate sophistication. - Leonardo da Vinci
Life is really simple, but we insist on making it complicated. - Confucius

Vibhu Rishi

unread,
Jan 6, 2014, 4:21:22 AM1/6/14
to django...@googlegroups.com
some more details of what I am looking for : 

Its a forum kind of thing. So, the model has a TextField where user can type whatever text he wants which can include urls and images. 

for urls, i can use a template filter like urlize
I want something similar for images ( imgize ? )

V. 

trojactory

unread,
Jan 6, 2014, 4:46:25 AM1/6/14
to django...@googlegroups.com
Hi Vibhu,

This works automatically for certain sites if they implement a standard called oEmbed (http://oembed.com/). Several sites like Flickr, Youtube etc support providing a thumbnail for a url within their domain. Django has several packages which support oEmbed, of which, I have used micawber (https://pypi.python.org/pypi/micawber) very successfully in the past.

For a general solution, you will need to download the page in the background and parse it for a representative image. 

Hope this addresses your question.

Regards,
Arun

Vibhu Rishi

unread,
Jan 6, 2014, 5:20:19 AM1/6/14
to django...@googlegroups.com
Hi Arun

Thanks man. This is also interesting. 

However, I dont really want to download the web and autolink the image ( as how it is in facebook - though I think now that I know i would want to try it out also). What I want to achieve is that if there is an image which a person has hosted on google+/flickr/etc , just pasting that url in his post will show the thumbnail of that image. So, lets say he has an album on google+, and he is referencing 2 or 3 images he can then just paste their links, and they show up as images. 

V. 


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/4bf2d938-75a2-4fa9-9796-9a52a150a073%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages