#!/usr/bin/env python
# -*- coding: utf-8 -*-
from libthumbor import CryptoURL
from django.conf import settings


crypto = CryptoURL(key=settings.THUMBOR_SECURITY_KEY)


def _remove_prefix(url, prefix):
    if url.startswith(prefix):
        return url[len(prefix):]
    return url


def _remove_schema(url):
    return _remove_prefix(url, 'http://')


def _prepend_media_url(url):
    if url.startswith(settings.MEDIA_URL):
        url = _remove_prefix(url, settings.MEDIA_URL)
        url.lstrip('/')
        return u'{}/{}'.format(settings.THUMBOR_MEDIA_URL, url)
    return url


def image_url(image_url, **kwargs):
    if not settings.THUMBOR_ENABLED or image_url.split('.')[-1] == 'git':
        # TODO: alternative ways for generating the thumbnails
        return image_url

    image_url = _prepend_media_url(image_url)
    image_url = _remove_schema(image_url)

    encrypted_url = crypto.generate(image_url=image_url,
                                    **dict(settings.THUMBOR_ARGUMENTS,
                                           **kwargs)).strip('/')

    return u'{}/{}'.format(settings.THUMBOR_SERVER, encrypted_url)

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from libthumbor import CryptoURL
from django.conf import settings


crypto = CryptoURL(key=settings.THUMBOR_SECURITY_KEY)


def _remove_prefix(url, prefix):
    if url.startswith(prefix):
        return url[len(prefix):]
    return url


def _remove_schema(url):
    return _remove_prefix(url, 'http://')


def _prepend_media_url(url):
    if url.startswith(settings.MEDIA_URL):
        url = _remove_prefix(url, settings.MEDIA_URL)
        url.lstrip('/')
        return u'{}/{}'.format(settings.THUMBOR_MEDIA_URL, url)
    return url


def image_url(image_url, **kwargs):
    if not settings.THUMBOR_ENABLED:
        # TODO: alternative ways for generating the thumbnails
        return image_url

    image_url = _prepend_media_url(image_url)
    image_url = _remove_schema(image_url)

    encrypted_url = crypto.generate(image_url=image_url,
                                    **dict(settings.THUMBOR_ARGUMENTS,
                                           **kwargs)).strip('/')

    return u'{}/{}'.format(settings.THUMBOR_SERVER, encrypted_url)

--- 
+++ 
@@ -26,7 +26,7 @@
 
 
 def image_url(image_url, **kwargs):
-    if not settings.THUMBOR_ENABLED:
+    if not settings.THUMBOR_ENABLED or image_url.split('.')[-1] == 'git':
         # TODO: alternative ways for generating the thumbnails
         return image_url
 
Fix render git, if gif file not render via thumbor
