Skip to content

Commit 7016ef0

Browse files
Christian Shearerclaude
andcommitted
Self-host optimized project images, fix St. Elmo and Grgich load times
- Download all 6 project images, resize to 800x400 at 80% quality - Images reduced from 8-19MB to 54-95KB each (99% size reduction) - Fix St. Elmo: original S3 URL was 403, sourced from Lookout Mountain Conservancy - Fix Grgich Hills: was 19MB, now 88KB - Serve from /projects/ route with 1-year cache headers Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 3eee429 commit 7016ef0

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

src/server/index.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,16 @@ export function startServer(options: { port?: number; dbPath?: string } = {}) {
275275
res.sendFile("og-card.jpg", { root: process.cwd() });
276276
});
277277

278+
// Project images (optimized, served from public/projects/ directory)
279+
app.get("/projects/:filename", (req, res) => {
280+
const filename = req.params.filename.replace(/[^a-zA-Z0-9._-]/g, "");
281+
if (!filename.match(/\.(png|jpg|jpeg|webp)$/i)) {
282+
return res.status(404).send("Not found");
283+
}
284+
res.setHeader("Cache-Control", "public, max-age=31536000");
285+
res.sendFile(`public/projects/${filename}`, { root: process.cwd() });
286+
});
287+
278288
// Team photos (served from public/team/ directory)
279289
app.get("/team/:filename", (req, res) => {
280290
const filename = req.params.filename.replace(/[^a-zA-Z0-9._-]/g, "");

src/server/project-metadata.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,7 @@ export const PROJECTS: ProjectInfo[] = [
4747
description:
4848
'El Globo is located in the "Cuchilla Jardin-Tamesis" Integrated Management District (DMI). Here ecosystem preservation, forest enhancement and restoration activities are implemented to generate positive and permanent impacts on biodiversity.',
4949
location: "Antioquia, Colombia",
50-
imageUrl:
51-
"https://regen-registry.s3.amazonaws.com/projects/146f8ea0-c484-11ee-9ebb-0a6e1e09fcad/1707323455220-TANGRA%20DE%20LENTEJUELAS.jpg",
50+
imageUrl: "/projects/opt-el-globo.jpg",
5251
projectPageUrl: "https://app.regen.network/project/BT01-001",
5352
accentColor: "#527984",
5453
},
@@ -61,8 +60,7 @@ export const PROJECTS: ProjectInfo[] = [
6160
description:
6261
"In the Amazon headwaters, Indigenous stewards face increasing pressure from activities like illegal logging and mining, which endanger both their forest ecosystem and cultural heritage. The Sharamentsa community, belonging to the Achuar Nation, is pivotal in this biodiversity project that focuses on safeguarding a critical 10,000-hectare jaguar habitat.",
6362
location: "Pastaza Province, Ecuador",
64-
imageUrl:
65-
"https://regen-registry.s3.amazonaws.com/projects/31f91f8c-8fd1-11ee-ba15-0267c2be097b/1732744057255-Jaguar_2023_RM_2.jpg",
63+
imageUrl: "/projects/opt-jaguar.jpg",
6664
projectPageUrl: "https://app.regen.network/project/USS01-002",
6765
accentColor: "#7c3aed",
6866
},
@@ -75,8 +73,7 @@ export const PROJECTS: ProjectInfo[] = [
7573
description:
7674
'The 15.14 acre Harvey Manning Park Expansion project is part of 33 acres in the "Issaquah Alps" comprised of Tiger, Squak, and Cougar Mountains, above Lake Sammamish. The 100+ year old forest includes riparian and wetland habitat that supports wildlife corridors on Cougar Mountain and protects cool freshwater streams that feed Tibbetts Creek, a salmon-bearing tributary to Lake Sammamish.',
7775
location: "Issaquah, Washington",
78-
imageUrl:
79-
"https://regen-registry.s3.amazonaws.com/projects/C02/harvey-manning-01.jpg",
76+
imageUrl: "/projects/opt-harvey-manning.jpg",
8077
projectPageUrl: "https://app.regen.network/project/C02-004",
8178
accentColor: "#4FB573",
8279
},
@@ -89,8 +86,7 @@ export const PROJECTS: ProjectInfo[] = [
8986
description:
9087
"Lookout Mountain is one of the most biologically diverse and critically imperiled ecoregions in the world stretching 90+ miles across three states; Tennessee, Alabama, and Georgia. The 58 acre oak-pine forest is situated between the Chickamauga & Chattanooga National Military Park and the historic St. Elmo neighborhood. By protecting this property, the Conservancy ensures connectivity between habitat corridors and provides essential wildlife habitat for several species.",
9188
location: "Chattanooga, Tennessee",
92-
imageUrl:
93-
"https://regen-registry.s3.amazonaws.com/projects/1f484f70-16cd-11ee-ab29-0a6e1e09fcad/1688078599319-Photo%20Oct%2023,%2011%2028%2022%20AM.jpg",
89+
imageUrl: "/projects/opt-st-elmo.jpg",
9490
projectPageUrl: "https://app.regen.network/project/C02-006",
9591
accentColor: "#4FB573",
9692
},
@@ -103,8 +99,7 @@ export const PROJECTS: ProjectInfo[] = [
10399
description:
104100
"The primary indicator in this credit class is soil organic carbon stocks (SOCS). Levels will be increased by growing harvestable and cover crops and grass to maximise canopy and root growth while incorporating crop residues and manures. Reduced soil disturbance, maintaining soil cover and returning crop residues will maximise retained organic matter in the soil.",
105101
location: "Oxfordshire, United Kingdom",
106-
imageUrl:
107-
"https://regen-registry.s3.amazonaws.com/projects/8cb44ebc-e532-11ef-8178-0afffa81c869/1738925262683-4.jpeg",
102+
imageUrl: "/projects/opt-pimlico.jpg",
108103
projectPageUrl: "https://app.regen.network/project/C06-002",
109104
accentColor: "#4FB573",
110105
},
@@ -117,8 +112,7 @@ export const PROJECTS: ProjectInfo[] = [
117112
description:
118113
"This project uses high-density, short-duration rotational sheep grazing in vineyard systems to improve ecosystem functioning through active management of the soil and herbaceous cover in the vineyard understory. The practice improves soil health, reduces use of herbicides or mowing, and enhances carbon storage.",
119114
location: "Napa Valley, California",
120-
imageUrl:
121-
"https://regen-registry.s3.amazonaws.com/projects/d1a8c4ec-4cf6-11ee-9623-0a6e1e09fcad/1694034028766-grgich1.jpg",
115+
imageUrl: "/projects/opt-grgich.jpg",
122116
projectPageUrl: "https://app.regen.network/project/KSH01-001",
123117
accentColor: "#a3785c",
124118
},

0 commit comments

Comments
 (0)