3

can someone please give me an example of how to change the SORL-thumbnail format in the django template tag.

I've read the documentation here: http://thumbnail.sorl.net/template.html#thumbnail

and have tried various ways of implimenting to no avail. I get errors similar to: 'thumbnail' tag received a bad argument: 'format'

My code works fine without the " format="png" " part, it just makes a jpg thumbnail. However, I want a png thumbnail. {% thumbnail product.main_image.picture 84x84 format="png" as image %}

Also, adding THUMBNAIL_FORMAT = "PNG" to my settings.py did nothing

Thanks,



UPDATE: HERE's HOW I FIXED THE PROBLEM:

So Issac and zachwood were right on. This was a version dependent thing. I resolved my problem this way:

1.) upgrade to newest sorl
1.1) syncdb
2.) in settings, changed THUMBNAIL_DEBUG = True
3.) added closing tag so the templates looked like :

        {% thumbnail product.main_image.picture "400x284" format="PNG"  as image %}

<img src="{{ media_url }}{{ image }}" width="{{ image.width }}" height="{{ image.height }}" alt="{{ product.short_description }}"/>

        {% endthumbnail %}

It worked!

4.)

Rishi
  • 3,538
  • 5
  • 29
  • 40
  • 1
    Could you verify that you're using version 11.04 (the version for the docs) and not an older version like 3.5? – Issac Kelly Oct 23 '11 at 02:44
  • So Issac and zachwood were right on. This was a version dependent thing. I resolved my problem and have updated my qeustion – Rishi Nov 03 '11 at 00:22
  • 1
    **RESOLVED:** The latest Satchmo version uses Sorl-thumbnail 11. Changed by fix [7f27358366a5](https://bitbucket.org/chris1610/satchmo/changeset/7f27358366a5) – hynekcer Apr 17 '12 at 22:37

1 Answers1

3

Unfortunately Satchmo uses SORL-Thumbnail version 3.2.5, those docs are for 11. My guess is they didn't support formats in version 3.x. I haven't had any luck finding docs for it but you can probably dig through the code to be sure.

If I remember correctly you can swap out the library for version 11, but you'll have to go through all the templates that use the template tag and add the {% endthumbnail %} tag after each time it's used (the endtag wasn't used back in version 3.x).

zachwood
  • 76
  • 1
  • 2