From 8abed680b33225426a1e89e314f89820f22440fd Mon Sep 17 00:00:00 2001 From: Michael Murtaugh Date: Wed, 29 Jan 2025 09:45:30 +0100 Subject: [PATCH] merged changes from mb, work on animation export view --- call/static/call/terms.json | 2 +- call/templates/call/call_block.html | 59 ++++++++++++++++++++++++ call/templates/call/creature_detail.html | 10 ++-- call/templates/call/index.html | 2 +- call/urls.py | 3 +- call/views.py | 29 +++++++++++- 6 files changed, 96 insertions(+), 9 deletions(-) create mode 100644 call/templates/call/call_block.html diff --git a/call/static/call/terms.json b/call/static/call/terms.json index e7366be..259620d 100644 --- a/call/static/call/terms.json +++ b/call/static/call/terms.json @@ -328,4 +328,4 @@ "complex", "artificial" ] -} +} \ No newline at end of file diff --git a/call/templates/call/call_block.html b/call/templates/call/call_block.html new file mode 100644 index 0000000..28fff40 --- /dev/null +++ b/call/templates/call/call_block.html @@ -0,0 +1,59 @@ +{% extends "call/base.html" %} +{% load static %} +{% block extrahead %} + + +{% endblock %} +{% block content %} +
+
+
+

+ The Master Experimental Publishing (XPUB) at the Piet Zwart Institute in Rotterdam (NL) is a two-year master focused on the acts of making things public and creating publics in the age of post-digital networks. +

+

XPUB is looking for new students! Come & join us!

+

Use the XPUB Community Builder below to put yourself on our digital guestbook, join an upcoming open day either online or in-person, and APPLY!

+

Application deadlines:

+

+

    +
  • March 4, 2024 (non-EU final + EU priority deadline)
  • +
  • May 8, 2024 (final EU deadline)
  • +
+

+

Open days:

+

+

+

+

+ +

+
+
+
+{% endblock %} \ No newline at end of file diff --git a/call/templates/call/creature_detail.html b/call/templates/call/creature_detail.html index bb77633..b234278 100644 --- a/call/templates/call/creature_detail.html +++ b/call/templates/call/creature_detail.html @@ -9,7 +9,7 @@ } @page { /* size: 2160px 3840px; */ - size: 432px 768px; + size: {{width}}px {{height}}px; margin: 0; } .flex-container { @@ -26,15 +26,15 @@ top: 0; bottom: 0; } div.caption div.captiontext { - font-size: 24px; + font-size: 2.5vh; /* 24px; */ } div.caption { /* border: 1px solid black; */ position: absolute; /* left: -480px; width: 960px; */ - left: -120px; - width: 240px; + left: -13vh; /* -120px; */ + width: 26vh; /* 240px; */ } @@ -42,7 +42,7 @@ {% block content %}
-
{{creature.caption}}
+
{{creature.caption}}
{% endblock %} \ No newline at end of file diff --git a/call/templates/call/index.html b/call/templates/call/index.html index 81ea0d8..69ec997 100644 --- a/call/templates/call/index.html +++ b/call/templates/call/index.html @@ -37,7 +37,7 @@

-

XPUB Community Builder

+

Join the (digital) Community

Add yourself to our digital guestbook!
What kind of XPUB student do you want to be?
(Activate your character by clicking on it!)

diff --git a/call/urls.py b/call/urls.py index 03194f2..995289f 100644 --- a/call/urls.py +++ b/call/urls.py @@ -17,7 +17,7 @@ Including another URLconf from django.contrib import admin from django.urls import path, include from call import views -from .views import Guestbook, CreatureList, creature_detail, creature_frame +from .views import Guestbook, CreatureList, creature_detail, creature_frame, call_block urlpatterns = [ path("guestbook/", Guestbook.as_view(), name="guestbook"), @@ -26,5 +26,6 @@ urlpatterns = [ path("creatures/", CreatureList.as_view(), name="creature_list"), path("creatures//", creature_detail, name="creature_detail"), path("creatures//frame/", creature_frame, name="creature_frame"), + path("call/block/", call_block, name="call_block"), path('', views.index) ] diff --git a/call/views.py b/call/views.py index 477a5fe..4dfab32 100644 --- a/call/views.py +++ b/call/views.py @@ -47,10 +47,19 @@ def creature_detail(request, creature_id): context = {} context['creature'] = get_object_or_404(Creature, pk=creature_id) context['cell'] = int(request.GET.get("cell", "0")) + context['scale'] = int(request.GET.get("scale", "6")) + context['width'] = int(request.GET.get("width", "432")) + context['height'] = int(request.GET.get("height", "768")) seed(creature_id) + context['bg_hue'] = randint(0, 360) context['bg_sat'] = 100 context['bg_lightness'] = randint(50, 100) + + # context['bg_hue'] = 0 # randint(0, 360) + # context['bg_sat'] = 0 # 100 + # context['bg_lightness'] = 66 # randint(50, 100) + return render(request, "call/creature_detail.html", context) def creature_frame (request, creature_id): @@ -59,7 +68,9 @@ def creature_frame (request, creature_id): creature = get_object_or_404(Creature, pk=creature_id) im = Image.open(creature.image.path) response = HttpResponse(content_type="image/png") - scale = 6 # 24 + scale = int(request.GET.get("scale", "6")) # 24 + # limit from 1-100 + scale = max(1, min(100, scale)) im = im.crop((16*cell, 0, (16*cell)+16, 16)) w, h = im.size im = im.resize((w*scale,h*scale), resample=Image.NEAREST) @@ -68,3 +79,19 @@ def creature_frame (request, creature_id): #im_with_background.paste(im, mask=im) #im_with_background.save(response, "PNG") return response + +def call_block(request): + """ Call text for animation """ + context = {} + context['width'] = int(request.GET.get("width", "432")) + context['height'] = int(request.GET.get("height", "768")) + + # context['bg_hue'] = randint(0, 360) + # context['bg_sat'] = 100 + # context['bg_lightness'] = randint(50, 100) + + context['bg_hue'] = 0 # randint(0, 360) + context['bg_sat'] = 0 # 100 + context['bg_lightness'] = 66 # randint(50, 100) + + return render(request, "call/call_block.html", context)