codingjoe/django-stdimage

Why stdimage not rendering in my html template?

Closed this issue · 1 comments

Why image is not rendering in my html template? here is my code:

#models.py

from django.db import models
from PIL import Image
from stdimage import StdImageField

class Contact(models.Model):
        name = models.CharField(max_length=200)
        image = StdImageField(upload_to="contact/images/",variations={'thumbnail': {'width': 750, 'height': 300}})

#settings.py
added 'stdimage' in my apps

#html
{{myimagefield.thumbnail}}

Hi @MDFARHYN,

Thank you for reaching out. This seems to be a template issue. I presume you want to use {{ myimagefield.thumbnail.url }} in your template, as you will probably not need the path but the file image file URL.

Best,
Joe