Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango: sorl-thumbnail
    primarykey
    data
    text
    <p>This is my code </p> <pre><code>{% thumbnail ham.thumbnail_url "50x20" crop="center" as im %} &lt;img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}"&gt; {% endthumbnail %} </code></pre> <p>and this is what the img src output looks like </p> <pre><code>cache/81/a8/81a884b2bce95dfe60e7397ea15d10f2.jpg </code></pre> <p>even with this example from the <a href="http://readthedocs.org/docs/sorl-thumbnails/en/latest/examples.html#model-examples" rel="nofollow">docs</a></p> <pre><code> {% thumbnail "http://www.aino.se/media/i/logo.png" "40x40" crop="80% top" as im %} &lt;img src="{{ im.url }}"&gt; {% endthumbnail %} </code></pre> <p>What's wrong?</p> <p><strong>Update</strong>:</p> <pre><code>{% thumbnail ham.thumbnail_url "220x120" crop="center" as foo %} &lt;img src="{{MEDIA_ROOT}}{{ foo.url }}" width="{{ foo.width }}" height="{{ foo.height }}"&gt; {% endthumbnail %} </code></pre> <p>Now i have a directory called 'cache' inside the 'media' directory that contains all the images, and the generated code is</p> <pre><code> &lt;img width="220" height="120" src="/media/cache/c6/5d/c65d3cd46c4ef6154c788526bfa3447f.jpg"&gt; </code></pre> <p>and this is my settings </p> <pre><code> MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media') MEDIA_URL = '/media/' STATIC_URL = '/static/' </code></pre> <p>but i can't see the images on screen == failed to load a given url(firebug)</p> <p>One possible way to make it work is to auto generate the cache directory inside the static directory. Works for me if i copied the cache dir to static dir and changed the settings to </p> <pre><code>MEDIA_URL = '' &lt;img src="{{STATIC_URL}}{{ foo.url }}" width="{{ foo.width }}" height="{{ foo.height }}"&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload