Images not displaying because of failed photo.get_thumbnail_url call for src attribute in <img> tag in Gallery Detail View

53 views
Skip to first unread message

Doug Snyder

unread,
Mar 4, 2015, 8:23:50 PM3/4/15
to django-p...@googlegroups.com
I'm having trouble with the src attribute of the <img> tags being empty in the gallery detail view which is supposed to load in the template via:  photo.get_thumbnail_url
The links to the photo detail template works fine which loads in the template via: photo.get_absolute_url
From the photo_detail there is also a link in the template from : href="{{ photo.get_absolute_url }}" which gets me to the actual image file thats working as expected.
I'm assuming the correct dependencies where given in the docs which don't include easy-thumnails
From Googling I've gathered photologue used to require easy-thumbnails
I'm assuming the photo.get_thumbnail_url should work with the dependencies described in the most recent docs and that this get_thumbnail_url is an analogous method that doesn't require easy-thumbnails ... is that right?
I also read about potential problems with Pillow and thought maybe scaling the images was failing to create the thumbnails but I've installed Pillow on OSX and CentOS7 without any apprent installation issues (
from PIL import Image woprks fine ) and am observing the exact same behavior.
I've gathered from something I read you need to define some photo sizes for the templates to work right although I don't see any mention of this in the docs.
I've got one called 'display' and one called 'admin_thumbnail' which I got from googling around.
I read the previous post here on this Google group and am not having trouble with my MEDIA_URL setting as far as I can see
I'm using default settings:

STATIC_URL = '/static/'
MEDIA_URL = '/media/'

Does anyone have any idea what can explain this behavior?
Does anyone know if there are going to be issues with PIL on CentOS7?
I'd prefer to know before getting locked into a hosting plan.

Best
Doug

Aitzol Naberan

unread,
Mar 5, 2015, 4:21:46 AM3/5/15
to django-p...@googlegroups.com
Hi,

You have to define the thumbnail photo size to get working the get_thumbnail_url  method.

This get_SIZE_url are currified methods, you get one of this methods per size defined in the admin.

Hope this helps

--
You received this message because you are subscribed to the Google Groups "Django Photologue" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-photolo...@googlegroups.com.
To post to this group, send email to django-p...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-photologue.
For more options, visit https://groups.google.com/d/optout.



--
Aitzol Naberan | CodeSyntax | +(34) 943 82 17 80

Doug Snyder

unread,
Mar 6, 2015, 2:11:57 AM3/6/15
to django-p...@googlegroups.com
Awesome, thanx. I knew there had to be something easy. But I'm kind of shocked this is not mentioned in the docs. There's mention of 'automatic' templates but actually using them requires you to know that you have to define photo sizes and guess naming conventions that are notveven mentioned in passing.

Peter Doherty

unread,
Aug 28, 2018, 4:57:52 PM8/28/18
to Django Photologue
I too, am having this issue (Using Django 2.1 and the latest issue of photologue). I checked my admin setting (pic below) and can't see how I implement the solution mentioned by Aitzol.

What am I doing wrong here?

Aitzol Naberan

unread,
Sep 6, 2018, 2:50:22 AM9/6/18
to django-p...@googlegroups.com
Hi

Not sure about your config (I didn't see any picture attached), but you can create photo size directly in the admin or using the specific photologue command plcreatesize

Once photo size is created you have to use get_NEW_PHOTO_SIZE_NAME_url in your template or view

Hope this helps



--
You received this message because you are subscribed to the Google Groups "Django Photologue" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-photolo...@googlegroups.com.
To post to this group, send email to django-p...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages