sorl-thumbnail

assign an image with ImageWithThumbnailsField (django sorl)

Hi there, I'm using ImageWithThumbnailsField from sorl to handle images on my project, without any problems. Now I'd like to use PIL to generate images out of my text, in some cases that the user doesn't upload photos. I'm having a bad time trying to figure what is the code, so any help would be appreciated! step 1. when user doesn't ...

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

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.p...

Django, sorl-thumb dont work

Hi guys, i dont know what im doing wrong, but sorl-thumb just upload the image but dont make thumbs... model.py from sorl.thumbnail.fields import ImageWithThumbnailsField ,ThumbnailField imagen = ImageWithThumbnailsField(upload_to='images', thumbnail={'size': (75, 75)}, ...

Django, sorl-thumbnail crop picture head

Hi, guys, i would like to know if sorl-thumbnail have any option to crop from the bottom to the top... i have a litter problem, in some picture sorl-thumbnail is croping the head of the people in pictures. Thanks ...

paths not being consistent python django.

I'm trying to import sorl-thumbnail into my app in django. Now the way that i have the site set up, using mod_wsgi on centos5 with cpanel the path for the apps must have the project name when importing... which is a pain. Obviously this is a cause of concern with portability of the app. I'm importing sorl-thumbnail, in previous apps i'v...

testing for a blank file upload

I have a model that looks like this: class ProjectImage(models.Model): project = models.ForeignKey(Project) in_slideshow = models.BooleanField(default=False) large_thumb = ImageWithThumbnailsField( upload_to='projects', thumbnail={'size': (500, 384), 'options': ['crop']}, generate_on_save=True, )...

sorl.thumbnail : 'thumbnail' is not a valid tag library ?

I am trying to install sorl.thumbnail but am getting the following error message: 'thumbnail' is not a valid tag library: Could not load template library from django.templatetags.thumbnail, No module named PIL This error popped up in this question as well http://stackoverflow.com/questions/1356334/need-help-solving-sorl-thumbnail-error...

User-Defined Thumnails for Django Project?

I'm putting together a Web site that makes heavy use of images. Those images need to be thumbnailed at various sizes to fit different templates. I'm aware of solutions like sorl-thumbnail, which seems perfect in every way except one: I need to be able to override automatic resizing and cropping if the computer's choice is a bad one. Fo...

Django / Python / PIL / sorl-thumbnail generation in bulk - memory error

hi folks! I'm trying to bulk generate 4 thumnails for each of around 40k images with sorl-thumbnail for my django app. I iterate through all django objects with an ImageWithThumbnailsFieldFile, and then call its generate_thumbnails() function. This works fine, except that after a few hundred iterations, I run out of memory and my loop ...

Thumbnails in the django admin panel using sorl.

Hey, I am trying to have the pictures I upload in the Django admin panel to show up as thumbnails instead of the path. I have sorl installed and can make thumbnails that show up in my views. I have found 2 snippets (http://www.djangosnippets.org/snippets/579/ and http://www.djangosnippets.org/snippets/934/) that I have tried to impleme...

Avoiding thumbnail name collisions with sorl-thumbnail

Understanding that I should probably just dig into the source to come up with a solution, I'm wondering if anyone has come up with a tactic for dealing with this. In my project, I have a lot of images being generated outside of the application. I'm isolating them on the filesystem based on a model's pk. For example, a model instance w...

sorl-thumbnail and file renaming

Hello, having a similar model: class Foo(models.Model): slug = models.SlugField(unique=True) img = ImageWithThumbnailsField(upload_to='uploads/',thumbnail={'size': (56, 34)}) It works fine but I want to add 2 more features to it: 1- It should also generate a second thumbnail sized 195x123, in addition to 56x34 2- While savin...

sorl-thumbnail: random name in Thumbnail field

I want to use str(uuid.uuid4()) instead of the name uploaded. I have this model: class foo(models.Model): pic = ThumbnailField(upload_to='pics', size=(200, 200)) I am uploading hello_world.jpg and I should save these named versions should be saved for example in 4ba9b397-da69-4307-9bce-e92887e84d2f.jpg. How can I do that? ...

sorl-thumbnail unit tests fail by 1 pixel (!)

Hi I'm using sorl-thumbnail in a Django 1.2 (currently 1.2 RC) project and getting a surprising failure of four of sorl's built-in unit tests. Essentially, the resized images are all 1px shorter than the unit tests expect them to be. See below for details I'm developing on OSX 10.5.8 (not Snow Leopard) with Python 2.5.1 (r251:54863, F...

How can I stop sorl thumbnail from breaking with very long filenames?

I've noticed that when working with SORL thumbnail, sometimes a user will upload an image with a very long filename, longer than the varfield in the database can hold. The name gets truncated in the database and the project gives errors whenever the image is requested. Is there a smart and safe way to have django automatically truncate ...