sorl-thumbnail

override save method - 'ImageFile' object has no attribute '_committed'

▼魔方 西西 提交于 2019-12-10 02:36:55
问题 I override the save method like below, and get_thumbnails and save with sorl.. But get the error 'ImageFile' object has no attribute '_committed' class HotelPhotos(models.Model): hotel = models.ForeignKey(Hotel, related_name='photos') code = models.CharField(max_length=255) original = models.ImageField(upload_to="media") medium = models.ImageField(upload_to="media", null=True, editable=False) thumbnail = models.ImageField(upload_to="media", null=True, editable=False) def save(self, *args, *

Sorl-thumbnail bugs 502 with large image

≡放荡痞女 提交于 2019-12-09 04:09:25
An error 502 Bad Gateway when I try to show in template large image (more then 2000x2000px) with Sorl-Thumbnail . No mistake if load page without thumbnail just picture and if less then 20000x2000px Already tried to change nginx config like this...: server { proxy_connect_timeout 1500; proxy_send_timeout 1500; proxy_read_timeout 1500; send_timeout 1500; location / { fastcgi_read_timeout 1500; } } Use regular code in template like {% thumbnail ph.image "500x500" crop="center" format="PNG" as im %} <img src="{{ im.url }}"/> {% endthumbnail %} Any advise pls? Just for google search Django Python

How to thumbnail static files?

断了今生、忘了曾经 提交于 2019-12-08 16:15:53
问题 I want to resize my static files with sorl thumbnail but it doesnt work here is my codes {% if not new.photo %} {% with path="{{STATIC_URL}}/images/empty-news.jpg" %} {% thumbnail path "80x80" crop="center" as im %} <a href="#" class="image"><img alt="" src="{{im.url}}" class="frame2"></a> {% endthumbnail %} {% endwith %} {% else %} {% thumbnail new.photo "80x80" crop="center" as im %} <a href="{% url news_detail new.slug %}" class="image"> <img alt="" src="{{im.url}}" class="frame2"></a> {%

Sorl-thumbnail bugs 502 with large image

天大地大妈咪最大 提交于 2019-12-08 05:37:55
问题 An error 502 Bad Gateway when I try to show in template large image (more then 2000x2000px) with Sorl-Thumbnail . No mistake if load page without thumbnail just picture and if less then 20000x2000px Already tried to change nginx config like this...: server { proxy_connect_timeout 1500; proxy_send_timeout 1500; proxy_read_timeout 1500; send_timeout 1500; location / { fastcgi_read_timeout 1500; } } Use regular code in template like {% thumbnail ph.image "500x500" crop="center" format="PNG" as

need help solving sorl-thumbnail error: “'thumbnail' is not a valid tag library:”

一曲冷凌霜 提交于 2019-12-08 03:15:28
问题 I've been pulling my hair out trying to solve this problem and I've tried everything and I have no ideas left. I keep seeing this error: Exception Value: 'thumbnail' is not a valid tag library: Could not load template library from django.templatetags.thumbnail, No module named sorl.thumbnail.main $DJANGO_PACKAGES/sorl/thumbnail/main.py DOES exist. Here's what I did to setup, downloaded latest sorl-thumbnail and added its location to the python path in .bash_profile included 'sorl.thumbnail'

How do I use sorl-thumbnail? (django)

不羁的心 提交于 2019-12-07 12:21:00
问题 I've been looking at the sorl-thumbnail's documentation, and I still can't figure out how to: 1. upload images to sorl-thumbnail. 2. selectively show images from sorl-thumbnail. (for example, load a specific image from sorl-thumbnail from a view and show it, with customized size, etc.) Could you give some specific examples on how to use this library in a django view? Thanks in advance : ) 回答1: If you want greater flexibility you can generate the thumbnail right in the view. The following is

need help solving sorl-thumbnail error: “'thumbnail' is not a valid tag library:”

前提是你 提交于 2019-12-06 05:00:12
I've been pulling my hair out trying to solve this problem and I've tried everything and I have no ideas left. I keep seeing this error: Exception Value: 'thumbnail' is not a valid tag library: Could not load template library from django.templatetags.thumbnail, No module named sorl.thumbnail.main $DJANGO_PACKAGES/sorl/thumbnail/main.py DOES exist. Here's what I did to setup, downloaded latest sorl-thumbnail and added its location to the python path in .bash_profile included 'sorl.thumbnail' in INSTALLED_APPS (in django's settings.py) used the {% load thumbnail %} tag in a django template It

How do I use sorl-thumbnail? (django)

穿精又带淫゛_ 提交于 2019-12-05 11:58:13
I've been looking at the sorl-thumbnail's documentation, and I still can't figure out how to: 1. upload images to sorl-thumbnail. 2. selectively show images from sorl-thumbnail. (for example, load a specific image from sorl-thumbnail from a view and show it, with customized size, etc.) Could you give some specific examples on how to use this library in a django view? Thanks in advance : ) If you want greater flexibility you can generate the thumbnail right in the view. The following is straight from the sorl-thumbnail documentation : from sorl.thumbnail import get_thumbnail im = get_thumbnail

How do I use Django, sorl-thumbnail, memcached, and S3 together?

夙愿已清 提交于 2019-12-03 14:41:11
问题 I've got a project in which I need to start creating dynamically-resized thumbnails of user-uploaded images, where previously I'd been generating some specifically sized ones. I have an existing model, which represents an image which looks like this: class Image(models.Model): original = models.URLField() small = models.URLField() medium = models.URLField() large = models.URLField() Each of those is filled in with a URL to the respective image on S3. At the time of upload, all the versions

Table thumbnail_kvstore doesn't exist

冷暖自知 提交于 2019-12-03 04:48:14
I can't get the thumbnail displayed in my template. I get this error: django.db.utils.ProgrammingError: (1146, "Table 'ia_website.thumbnail_kvstore' doesn't exist") Installed sorl_thumbnail-12.3 I'm using MariaDB 10.1.11 I have no migration that are not executed I can see the image if I don't use the 'thumbnail' tag Here is what I did In settings.py: INSTALLED_APPS = [ ... 'sorl.thumbnail', ] THUMBNAIL_DEBUG = TRUE In models.py import sorl ... image = sorl.thumbnail.ImageField(upload_to='thumbnails', null=True) In my template {% thumbnail content.image "237x110" as im %} <img src="{{ im.url }}