Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Load placeholder image with properly sizes

weronkac23369ce5cd2
diff --git a/saleor/graphql/api.py b/saleor/graphql/api.py
index 8548f9bbd4..80f3874d33 100644
--- a/saleor/graphql/api.py
+++ b/saleor/graphql/api.py
@@ -50,7 +50,7 @@ class ProductType(DjangoObjectType):
interfaces = (relay.Node, DjangoPkInterface)
def resolve_thumbnail_url(self, args, context, info):
- return product_first_image(self, '400x400')
+ return product_first_image(self, '255x255')
def resolve_images(self, args, context, info):
return self.images.all()
diff --git a/saleor/product/templatetags/product_images.py b/saleor/product/templatetags/product_images.py
index 046b5ba7d6..8b95f77ac7 100644
--- a/saleor/product/templatetags/product_images.py
+++ b/saleor/product/templatetags/product_images.py
@@ -23,8 +23,8 @@ AVAILABLE_SIZES = get_available_sizes()
@register.simple_tag()
def get_thumbnail(instance, size, method='crop'):
+ size_name = '%s__%s' % (method, size)
if instance:
- size_name = '%s__%s' % (method, size)
if (size_name not in AVAILABLE_SIZES and not
settings.VERSATILEIMAGEFIELD_SETTINGS['create_images_on_demand']):
msg = ('Thumbnail size %s is not defined in settings '
@@ -40,7 +40,7 @@ def get_thumbnail(instance, size, method='crop'):
extra={'instance': instance, 'size': size})
else:
return thumbnail.url
- return static('images/product-image-placeholder.png')
+ return static('images/placeholder' + size + '.png')
@register.simple_tag()
diff --git a/saleor/static/images/placeholder1080x1080.png b/saleor/static/images/placeholder1080x1080.png
new file mode 100644
index 0000000000..8fd6bf6078
Binary files /dev/null and b/saleor/static/images/placeholder1080x1080.png differ
diff --git a/saleor/static/images/placeholder120x120.png b/saleor/static/images/placeholder120x120.png
new file mode 100644
index 0000000000..9be8593dbd
Binary files /dev/null and b/saleor/static/images/placeholder120x120.png differ
diff --git a/saleor/static/images/placeholder255x255.png b/saleor/static/images/placeholder255x255.png
new file mode 100644
index 0000000000..90451c5134
Binary files /dev/null and b/saleor/static/images/placeholder255x255.png differ
diff --git a/saleor/static/images/placeholder540x540.png b/saleor/static/images/placeholder540x540.png
new file mode 100644
index 0000000000..409d9bee0c
Binary files /dev/null and b/saleor/static/images/placeholder540x540.png differ
diff --git a/templates/cart/index.html b/templates/cart/index.html
index a6bdefb4ec..4ff916c522 100644
--- a/templates/cart/index.html
+++ b/templates/cart/index.html
@@ -3,6 +3,7 @@
{% load i18n %}
{% load static from staticfiles %}
{% load render_bundle from webpack_loader %}
+{% load get_thumbnail from product_images %}
{% block title %}{% trans "Your cart" context "Cart page title" %} — {{ block.super }}{% endblock %}