Skip to content

Commit 7aa66a0

Browse files
committed
Added workflow to enforce better image standards
Shame on me for trying to make it look pretty Updated all images to webp Updated the WebP workflow to fix issue with the way find command returns
1 parent 91e045c commit 7aa66a0

300 files changed

Lines changed: 201 additions & 157 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/webp.yaml‎

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# This workflow will scan the repo for images not in webp and will fail if it
2+
# finds any. This is to standardise the repo to one image format and hopefully
3+
# improve the loading time of comp-soc.com
4+
5+
name: Confirm all images are standard format
6+
7+
on:
8+
push:
9+
10+
jobs:
11+
check-images:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
17+
- name: Fail for non-compliant images
18+
run: |
19+
if [[ -n $(find . -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.jfif' -o -iname '*.pjpeg' -o -iname '*.pjp' -o -iname '*.png' -o -iname '*.apng' -o -iname '*.gif' -o -iname '*.bmp' -o -iname '*.tif' -o -iname '*.tiff' \) ! -name '*.norender') ]]; then
20+
echo "Non-compliant image files found. Please convert them to lossless WebP (preferred) or AVIF for bitmap graphics, or SVG for vector graphics. If files are not to be rendered and are kept for posterity (or you realllllyyyy don't want to let go of your precious TIFF files) please append '.norender' to the file name."
21+
exit 1
22+
else
23+
echo "All images appear compliant."
24+
fi
25+
26+
- name: Warn for ICO usage
27+
run: |
28+
if [[ -n $(find . -type f -iname '*.ico') ]]; then
29+
echo "ICO is no longer the preferred standard for favicons, and should not be used in web content. Please see: https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/link#providing_icons_for_different_usage_contexts"
30+
exit 0
31+
else
32+
exit 0
33+
fi
34+
35+
- name: Warn for non-compliant image links
36+
run: |
37+
if grep -r --include="*.html" --include="*.md" -E 'src="[^"]*\.(jpg|jpeg|jfif|pjpeg|pjp|png|apng|gif|bmp|tif|tiff)"' . 2>/dev/null; then
38+
echo "Warning: found references to non-compliant image formats in HTML/Markdown files, consider updating image links to use WebP, AVIF, or SVG instead."
39+
exit 0
40+
else
41+
echo "No non-compliant image links found in HTML/Markdown files."
42+
exit 0
43+
fi
44+

‎components/CompSocTitle.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ const CompSocTitle = () => {
7272
<div className="flex flex-col items-center">
7373
<GodRays>
7474
<Image
75-
src={`${prefix}/compsoc-short.png`}
75+
src={`${prefix}/compsoc-short.webp`}
7676
alt="CompSoc logo"
7777
width={256}
7878
height={256}
@@ -83,7 +83,7 @@ const CompSocTitle = () => {
8383
}}
8484
/>
8585
<Image
86-
src={`${prefix}/compsoc-long.png`}
86+
src={`${prefix}/compsoc-long.webp`}
8787
alt="CompSoc logo"
8888
width={516}
8989
height={256}

‎components/eventsection/ImageCarousel.tsx‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,37 @@ import { prefix } from '@/utils/prefix'
55
const ImageCarousel: React.FC = () => {
66
const images = [
77
{
8-
src: `${prefix}/image1.jpg`,
8+
src: `${prefix}/image1.webp`,
99
alt: 'People sitting in rows, some working on laptops with stickers, others conversing, in an indoor setting.',
1010
footer: 'Hack The Burgh',
1111
},
1212
{
13-
src: `${prefix}/image2.jpg`,
13+
src: `${prefix}/image2.webp`,
1414
alt: 'Audience of people laughing and enjoying an event in an indoor setting.',
1515
footer: 'STMU 2024',
1616
},
1717
{
18-
src: `${prefix}/image3.jpg`,
18+
src: `${prefix}/image3.webp`,
1919
alt: 'Group of people playing pool under green hanging lights, with some engaging in conversation and holding pool cues.',
2020
footer: 'Pub Crawl 2024',
2121
},
2222
{
23-
src: `${prefix}/image4.jpg`,
23+
src: `${prefix}/image4.webp`,
2424
alt: 'Group of people dancing in pairs in a dimly lit venue, dressed in formal and semi-formal attire.',
2525
footer: 'CompSoc InfBall 2024',
2626
},
2727
{
28-
src: `${prefix}/image5.jpg`,
28+
src: `${prefix}/image5.webp`,
2929
alt: 'Group of people working together on laptops and discussing in a well-lit indoor setting with large windows',
3030
footer: 'Hack The Burgh',
3131
},
3232
{
33-
src: `${prefix}/image6.jpg`,
33+
src: `${prefix}/image6.webp`,
3434
alt: 'Couples dancing in formal attire at a lively event in a brick-walled venue with string lights.',
3535
footer: 'CompSoc InfBall 2024',
3636
},
3737
{
38-
src: `${prefix}/image7.jpg`,
38+
src: `${prefix}/image7.webp`,
3939
alt: 'Audience members attentively watching a presentation or event in a lecture hall.',
4040
footer: 'Hack The Burgh Prize Announcements',
4141
},

‎components/footer/FooterCanvas.tsx‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -79,24 +79,24 @@ const FooterCanvas = () => {
7979
)
8080

8181
const images = [
82-
`${prefix}/footerIcons/AT-lifts.png`,
83-
`${prefix}/footerIcons/AT.png`,
84-
`${prefix}/footerIcons/CompMug.png`,
85-
`${prefix}/footerIcons/CompSoc-laptop.png`,
86-
`${prefix}/footerIcons/CompSock-pride.png`,
87-
`${prefix}/footerIcons/CompSock.png`,
88-
`${prefix}/footerIcons/AT-lifts.png`,
89-
`${prefix}/footerIcons/AT.png`,
90-
`${prefix}/footerIcons/CompMug.png`,
91-
`${prefix}/footerIcons/CompSoc-laptop.png`,
92-
`${prefix}/footerIcons/CompSock-pride.png`,
93-
`${prefix}/footerIcons/CompSock.png`,
94-
`${prefix}/footerIcons/AT-lifts.png`,
95-
`${prefix}/footerIcons/AT.png`,
96-
`${prefix}/footerIcons/CompMug.png`,
97-
`${prefix}/footerIcons/CompSoc-laptop.png`,
98-
`${prefix}/footerIcons/CompSock-pride.png`,
99-
`${prefix}/footerIcons/CompSock.png`,
82+
`${prefix}/footerIcons/AT-lifts.webp`,
83+
`${prefix}/footerIcons/AT.webp`,
84+
`${prefix}/footerIcons/CompMug.webp`,
85+
`${prefix}/footerIcons/CompSoc-laptop.webp`,
86+
`${prefix}/footerIcons/CompSock-pride.webp`,
87+
`${prefix}/footerIcons/CompSock.webp`,
88+
`${prefix}/footerIcons/AT-lifts.webp`,
89+
`${prefix}/footerIcons/AT.webp`,
90+
`${prefix}/footerIcons/CompMug.webp`,
91+
`${prefix}/footerIcons/CompSoc-laptop.webp`,
92+
`${prefix}/footerIcons/CompSock-pride.webp`,
93+
`${prefix}/footerIcons/CompSock.webp`,
94+
`${prefix}/footerIcons/AT-lifts.webp`,
95+
`${prefix}/footerIcons/AT.webp`,
96+
`${prefix}/footerIcons/CompMug.webp`,
97+
`${prefix}/footerIcons/CompSoc-laptop.webp`,
98+
`${prefix}/footerIcons/CompSock-pride.webp`,
99+
`${prefix}/footerIcons/CompSock.webp`,
100100
].slice(0, window.innerWidth < 768 ? 10 : 20) // Very sloppy and wont resize
101101

102102
const bodies = images.map((src) => {

‎components/moreResourcesSection/moreResourcesSection.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ const MoreResourcesSection = () => {
4444
url="https://edinburghhoppers.com/"
4545
>
4646
<Image
47-
src={`${prefix}/hoppers-logo.png`}
47+
src={`${prefix}/hoppers-logo.webp`}
4848
alt="Hoppers logo"
4949
width={100}
5050
height={100}
@@ -64,7 +64,7 @@ const MoreResourcesSection = () => {
6464
url="https://files.betterinformatics.com/"
6565
>
6666
<Image
67-
src={`${prefix}/betterinformatics-logo.png`}
67+
src={`${prefix}/betterinformatics-logo.webp`}
6868
alt="BetterInformatics logo"
6969
width={100}
7070
height={100}

‎components/sponsorsection/HoverGif.tsx‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const HoverGif = () => {
1212
onMouseLeave={() => setIsHovered(false)}
1313
>
1414
<Image
15-
src={`${prefix}/heart-static.png`}
15+
src={`${prefix}/heart-static.webp`}
1616
alt="Static Icon"
1717
layout="fill"
1818
objectFit="contain"
@@ -21,7 +21,7 @@ const HoverGif = () => {
2121
}`}
2222
/>
2323
<Image
24-
src={`${prefix}/heart.gif`}
24+
src={`${prefix}/heart.webp`}
2525
alt="GIF Icon"
2626
layout="fill"
2727
objectFit="contain"

‎constants/SIGs.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export const SIGs: SIG[] = [
1111
calendarURL:
1212
'c_78e0084b4542572dfbd710bce8243f0e7721a211db4b5567b795d94fce574d18@group.calendar.google.com',
1313
icon: {
14-
src: 'projectshare.png',
14+
src: 'projectshare.webp',
1515
alt: 'ProjectShare logo',
1616
rounded: 'rounded-lg',
1717
},
@@ -129,7 +129,7 @@ export const SIGs: SIG[] = [
129129
name: 'CloudSIG',
130130
description: 'An AWS Cloud Club',
131131
icon: {
132-
src: 'CloudSIGLogo.png',
132+
src: 'CloudSIGLogo.webp',
133133
alt: 'CloudSIG logo',
134134
rounded: 'rounded-lg',
135135
},
@@ -146,7 +146,7 @@ export const SIGs: SIG[] = [
146146
description:
147147
'OS, computer networks, computer architectures, parallel and distributed systems.',
148148
icon: {
149-
src: 'bitsig.png',
149+
src: 'bitsig.webp',
150150
alt: 'BitSig logo',
151151
rounded: 'rounded-lg',
152152
},
@@ -162,7 +162,7 @@ export const SIGs: SIG[] = [
162162
name: 'Flagship',
163163
description: '',
164164
icon: {
165-
src: 'compsoc-short.png',
165+
src: 'compsoc-short.webp',
166166
alt: 'the compsoc logo',
167167
rounded: 'rounded-none',
168168
},
@@ -178,7 +178,7 @@ export const SIGs: SIG[] = [
178178
name: 'CompSoc',
179179
description: '',
180180
icon: {
181-
src: 'compsoc-short.png',
181+
src: 'compsoc-short.webp',
182182
alt: 'CompSoc logo',
183183
rounded: 'rounded-none',
184184
},
@@ -195,7 +195,7 @@ export const SIGs: SIG[] = [
195195
description:
196196
'The launchpad for the University of Edinburgh’s boldest student founders and innovators',
197197
icon: {
198-
src: 'evp.png',
198+
src: 'evp.webp',
199199
alt: 'EVP logo',
200200
rounded: 'rounded-none',
201201
},
@@ -210,7 +210,7 @@ export const SIGs: SIG[] = [
210210
name: 'Edinburgh Neurotech',
211211
description: 'At the intersection of neuroscience and technology',
212212
icon: {
213-
src: 'edneurotech.png',
213+
src: 'edneurotech.webp',
214214
alt: 'Edinburgh Neurotech logo',
215215
rounded: 'rounded-none',
216216
},

‎constants/flagships.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export const flagships: Flagship[] = [
3636
'Engage with insightful talks from academics and industry experts, and enjoy free pizza!',
3737
long_description:
3838
'CompSoc hosts many STMUs throughout the year. A Student Tech Meetup is an academic setting where speakers come to talk to students about their field of interest. Notable past speakers have included the creator of the UK’s best chess engine, the designer of Haskell, and industry experts from Meta and Spotify. The best part about it, it’s free and has free food!',
39-
image: 'stmu.jpg',
39+
image: 'stmu.webp',
4040
roughDate: 'Monthly',
4141
facts: [{ number: '30-70', text: 'attendees' }],
4242
},

‎constants/news/2022-03-30-agm-results.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ author: tcmal
66
Thank you to everyone who came to our AGM+STMU yesterday, hopefully you enjoyed it as much as we did!
77
We're proud to announce our new committee!
88

9-
<img src="/static/img/team/2022-agm.jpg" alt="Image of new committee" style="width: 100%">
9+
<img src="/static/img/team/2022-agm.webp" alt="Image of new committee" style="width: 100%">
1010

1111
- **President** - Ben McConville
1212
- **Vice President** - Krzysztof Grykiel

0 commit comments

Comments
 (0)