diff --git a/src/components/EventImageGenerator.svelte b/src/components/EventImageGenerator.svelte index 48f7d0f..080fa3f 100644 --- a/src/components/EventImageGenerator.svelte +++ b/src/components/EventImageGenerator.svelte @@ -2,6 +2,7 @@ import core from '../core.json'; import genImages from '../gen-images.json'; +import genImagesOffsets from '../gen-images-offsets.yaml'; import { dateFormat } from '../lib/events.js'; import { marked } from 'marked'; @@ -88,11 +89,37 @@ eventSelected.subscribe((id, next) => { function getImageUrl(img) { return `/gen-img/events/${img}.png` } +function getImageData(img) { + return Object.assign({}, genImages[img], { + src: `/gen-img/events/${img}.png`, + offsets: genImagesOffsets[img], + calcObjOffsets: function (tp) { + const co = image.offsets?.[tp]; + if (!co) { + return ''; + } + return `object-position: ${co.x || 'center'} ${co.y || 'center'}`; + }, + calcBgOffsets: function(tp) { + const arr = []; + const co = image.offsets?.[tp]; + if (!co) { + return ''; + } + if (co.x) { + arr.push(`background-position-x: ${co.x};`) + } + if (co.y) { + arr.push(`background-position-y: ${co.y};`) + } + return arr.join(' ') + } + }) +} -$: image = $imageSelected ? getImageUrl($imageSelected) : ''; +$: image = $imageSelected ? getImageData($imageSelected) : ''; $: event = core.events.find(e => e.id === $eventSelected); $: speaker = core.people.find(p => p.id === $speakerSelected); -$: imgSrc = genImages[$imageSelected]; const tools = { dateFormat @@ -132,11 +159,11 @@ const tools = {
{event.id} [{event.design?.image || '-'}]
- {#if event.images['poster-simple'] || event.images.poster} - + {#if event.images?.['poster-simple'] || event.images?.poster} + {:else}
- +
{/if}
@@ -159,14 +186,14 @@ const tools = {
-{#if imgSrc} +
Square (1:1)
- +
@@ -174,7 +201,7 @@ const tools = {
Wide-square (4:3)
- +
@@ -182,7 +209,7 @@ const tools = {
Wide (16:9)
- +
@@ -200,7 +227,7 @@ const tools = {
- +
@@ -208,7 +235,7 @@ const tools = {
Poster (1:1.414)
- +
@@ -216,9 +243,8 @@ const tools = {
Poster (simple) (1:1.414)
- +
-{/if} {/if} \ No newline at end of file diff --git a/src/components/event-formats/poster-simple.svelte b/src/components/event-formats/poster-simple.svelte index ff5c897..f4bcd2c 100644 --- a/src/components/event-formats/poster-simple.svelte +++ b/src/components/event-formats/poster-simple.svelte @@ -2,7 +2,6 @@ export let event; export let image; export let tools; - export let imgSrc;
@@ -11,7 +10,7 @@ {#if event.type === 'summit'}
-
+
@@ -27,7 +26,7 @@ {:else}
-
+
diff --git a/src/components/event-formats/poster.svelte b/src/components/event-formats/poster.svelte index 8c7442b..4a14180 100644 --- a/src/components/event-formats/poster.svelte +++ b/src/components/event-formats/poster.svelte @@ -3,14 +3,13 @@ export let image; export let tools; export let topics; - export let imgSrc;
- +
diff --git a/src/components/event-formats/square-speaker.svelte b/src/components/event-formats/square-speaker.svelte index 5e853e3..122b08e 100644 --- a/src/components/event-formats/square-speaker.svelte +++ b/src/components/event-formats/square-speaker.svelte @@ -11,7 +11,7 @@
- +
{tools.dateFormat(event.date)}
@@ -21,7 +21,7 @@
- + {#if speaker.refs?.twitter || speaker.refs?.bsky}
diff --git a/src/components/event-formats/square.svelte b/src/components/event-formats/square.svelte index 6531149..c125ef6 100644 --- a/src/components/event-formats/square.svelte +++ b/src/components/event-formats/square.svelte @@ -10,7 +10,7 @@
- +
diff --git a/src/components/event-formats/wide-square.svelte b/src/components/event-formats/wide-square.svelte index 9e68fc9..4d9dd2c 100644 --- a/src/components/event-formats/wide-square.svelte +++ b/src/components/event-formats/wide-square.svelte @@ -5,7 +5,6 @@ export let event; export let image; export let tools; - export let imgSrc; @@ -14,10 +13,10 @@
-
+
-
- +
+
diff --git a/src/components/event-formats/wide.svelte b/src/components/event-formats/wide.svelte index d7c396c..d3f8dab 100644 --- a/src/components/event-formats/wide.svelte +++ b/src/components/event-formats/wide.svelte @@ -2,7 +2,6 @@ export let event; export let image; export let tools; - export let imgSrc; @@ -12,10 +11,10 @@
-
+
-
- +
+
diff --git a/src/core.json b/src/core.json index 44bd75c..91fb743 100644 --- a/src/core.json +++ b/src/core.json @@ -1096,15 +1096,7 @@ "tim-bansemer", "mykola-siusko", "gabari" - ], - "images": { - "square": "https://data.web3privacy.info/img/events/2024/m24buc-square.png", - "wide": "https://data.web3privacy.info/img/events/2024/m24buc-wide.png", - "poster": "https://data.web3privacy.info/img/events/2024/m24buc-poster.png", - "wide-square": "https://data.web3privacy.info/img/events/2024/m24buc-wide-square.png", - "poster-simple": "https://data.web3privacy.info/img/events/2024/m24buc-poster-simple.png" - }, - "thumbs": {} + ] }, { "id": "m24ams", @@ -1132,11 +1124,7 @@ ], "design": { "image": "amsterdam01" - }, - "images": { - "square": "https://data.web3privacy.info/img/events/2024/m24ams-square.png" - }, - "thumbs": {} + } }, { "id": "m24ber", @@ -1167,9 +1155,7 @@ }, "design": { "image": "berlin03" - }, - "images": {}, - "thumbs": {} + } }, { "id": "s24prg", @@ -1199,9 +1185,7 @@ ], "design": { "image": "summit02" - }, - "images": {}, - "thumbs": {} + } }, { "id": "q24ble", @@ -1231,9 +1215,7 @@ "mykola-siusko", "pg", "tree" - ], - "images": {}, - "thumbs": {} + ] }, { "id": "m24lju", @@ -1256,9 +1238,7 @@ "speakers": [ "joshua-davila", "mykola-siusko" - ], - "images": {}, - "thumbs": {} + ] }, { "id": "os24q2", @@ -1270,9 +1250,7 @@ "slots": 8, "links": { "rsvp": "https://lu.ma/w3pn-os24q2" - }, - "images": {}, - "thumbs": {} + } }, { "id": "m24bcn", @@ -1289,9 +1267,7 @@ }, "speakers": [ "joshua-davila" - ], - "images": {}, - "thumbs": {} + ] }, { "id": "m24bru", @@ -1316,9 +1292,7 @@ "edward-fricker", "joshua-davila", "mykola-siusko" - ], - "images": {}, - "thumbs": {} + ] }, { "id": "m24waw", @@ -1336,9 +1310,7 @@ }, "links": { "rsvp": "https://lu.ma/w3pn-m24waw" - }, - "images": {}, - "thumbs": {} + } }, { "id": "os24q3", @@ -1346,9 +1318,7 @@ "name-extension": "Q3", "date": "2024/Sep", "lead": "Tree", - "slots": 8, - "images": {}, - "thumbs": {} + "slots": 8 }, { "id": "m24cph", @@ -1373,9 +1343,7 @@ }, "speakers": [ "jaromil" - ], - "images": {}, - "thumbs": {} + ] }, { "id": "m24rom", @@ -1401,9 +1369,7 @@ "jaromil", "vaclav-pavlin", "mykola-siusko" - ], - "images": {}, - "thumbs": {} + ] }, { "id": "c24rom", @@ -1415,9 +1381,7 @@ "country": "it", "coincidence": "ETHRome", "coincidenceFull": "ETHRome 2024", - "lead": "Tree", - "images": {}, - "thumbs": {} + "lead": "Tree" }, { "id": "s24brn", @@ -1447,9 +1411,7 @@ ], "design": { "image": "brno01" - }, - "images": {}, - "thumbs": {} + } }, { "id": "c24brn", @@ -1461,9 +1423,7 @@ "country": "cz", "coincidence": "ETHBrno", "coincidenceFull": "ETHBrno3", - "lead": "Tree", - "images": {}, - "thumbs": {} + "lead": "Tree" }, { "id": "m24dc", @@ -1483,9 +1443,7 @@ "speakers": [ "edward-fricker", "vaclav-pavlin" - ], - "images": {}, - "thumbs": {} + ] }, { "id": "os24q4", @@ -1493,9 +1451,7 @@ "name-extension": "Q4", "date": "2024/Dec", "lead": "Tree", - "slots": 8, - "images": {}, - "thumbs": {} + "slots": 8 } ] } \ No newline at end of file diff --git a/src/gen-images-offsets.yaml b/src/gen-images-offsets.yaml new file mode 100644 index 0000000..5a2e3c9 --- /dev/null +++ b/src/gen-images-offsets.yaml @@ -0,0 +1,28 @@ +bucharest01: + square: { x: 65% } + poster: { x: 65% } + poster-simple: { x: 69% } +amsterdam01: + square: { x: 72% } + wide-square: { x: 55% } + wide: { x: 10% } + poster: { x: 75% } + poster-simple: { x: 77% } +barcelona02: + square: { x: 0% } + poster: { x: 38% } + poster-simple: { x: 35% } +brussels01: + square: { x: 55% } + wide: { x: 0% } +warsaw01: + square: { x: 93% } + wide-square: { x: 70% } + poster: { x: 55% } + poster-simple: { x: 59% } +copenhagen02: + square: { x: 100% } + wide-square: { x: 100% } + wide: { x: 100% } + poster: { x: 100% } + poster-simple: { x: 108% } \ No newline at end of file