<commit_before>Django Thumbnails
*****************

.. highlight:: python

Requirements:

.. code-block:: text

  requirements/base.txt

  easy-thumbnails
  pillow

For an app::

  # example/base.py

  THUMBNAIL_DEBUG = DEBUG
  INSTALLED_APPS = (
      ...
      'django.contrib.staticfiles',
      'easy_thumbnails',

For a project::

  # settings/production.py
  THUMBNAIL_DEBUG = DEBUG

  # settings/local.py
  THUMBNAIL_DEBUG = DEBUG

  # settings/base.py
  DJANGO_APPS = (
      ...
      'django.contrib.staticfiles',

  THIRD_PARTY_APPS = (
      ...
      'easy_thumbnails',

In your templates:

.. code-block:: html

  {% load thumbnail %}
  <img src="{% thumbnail story.picture 100x100 crop %}" />

The easy thumbnail module creates a new image alongside your current image
e.g:

.. code-block:: bash

  ls -l media/story/2013/10/18/

  banner.jpg
  banner.jpg.100x100_q85_crop.jpg

Issues
======

If you are having trouble with the thumbnail template tag and you don't know
what is causing the problem, then start by replacing the ``thumbnail`` tag
with the ``MEDIA_URL`` and path e.g:<commit_msg>easy_thumbnails<commit_after>Django Thumbnails
*****************

.. highlight:: python

Requirements:

.. code-block:: text

  requirements/base.txt

  easy-thumbnails
  pillow

For an app::

  # example/base.py

  THUMBNAIL_DEBUG = DEBUG
  INSTALLED_APPS = (
      ...
      'django.contrib.staticfiles',
      'easy_thumbnails',

For a project::

  # settings/production.py
  THUMBNAIL_DEBUG = DEBUG

  # settings/local.py
  THUMBNAIL_DEBUG = DEBUG

  # settings/base.py
  DJANGO_APPS = (
      ...
      'django.contrib.staticfiles',

  THIRD_PARTY_APPS = (
      ...
      'easy_thumbnails',

  SOUTH_MIGRATION_MODULES = {
      'easy_thumbnails': 'easy_thumbnails.south_migrations',
  }

In your templates:

.. code-block:: html

  {% load thumbnail %}
  <img src="{% thumbnail story.picture 100x100 crop %}" />

The easy thumbnail module creates a new image alongside your current image
e.g:

.. code-block:: bash

  ls -l media/story/2013/10/18/

  banner.jpg
  banner.jpg.100x100_q85_crop.jpg

Issues
======

If you are having trouble with the thumbnail template tag and you don't know
what is causing the problem, then start by replacing the ``thumbnail`` tag
with the ``MEDIA_URL`` and path e.g:
{'fraction_non_alphanumeric': 0.12445980985306827, 'fraction_numerical': 0.01901469317199654, 'mean_word_length': 3.0973451327433628, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3200886', 'n_tokens_mistral': 867, 'n_tokens_neox': 793, 'n_words': 200}