You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello I'm trying to extract image from the content my user posts. (I know it sounds little bit odd)
I'm using wyswyg editor, django-ckeditor and when user posts text with images they are grouped as content. So to display the content(image and text), I do {{post.content}}. But I want to thumbnail an image in the front page, if there's an image in context. So I'm trying to extract image from the content in my db.
This is my try,
from goose import Goose
class Post(models.Model):
content = RichTextUploadingField(config_name='default')
@property
def thumbnail(self, content):
g = Goose()
thumbnail = g.extract(raw_html=self.content).top_image.src
return thumbnail
to display the image, I did <img src = "{{post.thumbnail}}" />but nothing shows up. no error, no image.
Is it possible to do the following feature with python goose? am I doing it wrong?
The text was updated successfully, but these errors were encountered:
Hello I'm trying to extract image from the content my user posts. (I know it sounds little bit odd)
I'm using wyswyg editor, django-ckeditor and when user posts text with images they are grouped as content. So to display the content(image and text), I do {{post.content}}. But I want to thumbnail an image in the front page, if there's an image in context. So I'm trying to extract image from the content in my db.
This is my try,
to display the image,
I did <img src = "{{post.thumbnail}}" />
but nothing shows up. no error, no image.Is it possible to do the following feature with python goose? am I doing it wrong?
The text was updated successfully, but these errors were encountered: