from django import template
from django.conf import settings
from django.urls import reverse


register = template.Library()


@register.simple_tag
def image(img, **kwargs):
    if not img:
        if settings.DEBUG:
            raise ValueError('No image path defined')
        return ''

    # Convert the kwargs to an appropriate string
    options = []
    for key, value in kwargs.items():
        options.append('{key},{value}'.format(key=key, value=value))

    return reverse('rszio_image', kwargs={
        'options': ';'.join(options),
        'path': img,
    })

from django import template
from django.urls import reverse


register = template.Library()


@register.simple_tag
def image(img, **kwargs):
    # Convert the kwargs to an appropriate string
    options = []
    for key, value in kwargs.items():
        options.append('{key},{value}'.format(key=key, value=value))

    return reverse('rszio_image', kwargs={
        'options': ';'.join(options),
        'path': img,
    })

--- 
+++ 
@@ -1,4 +1,5 @@
 from django import template
+from django.conf import settings
 from django.urls import reverse
 
 
@@ -7,6 +8,11 @@
 
 @register.simple_tag
 def image(img, **kwargs):
+    if not img:
+        if settings.DEBUG:
+            raise ValueError('No image path defined')
+        return ''
+
     # Convert the kwargs to an appropriate string
     options = []
     for key, value in kwargs.items():
Raise ValueError when no path and DEBUG

Fails silently when DEBUG is False
