Skip to content

Commit

Permalink
use unpic with ipx
Browse files Browse the repository at this point in the history
  • Loading branch information
nimarion committed Oct 11, 2024
1 parent 6e7d565 commit 2c7013e
Show file tree
Hide file tree
Showing 14 changed files with 97 additions and 169 deletions.
5 changes: 3 additions & 2 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@
"class-transformer": "^0.5.1",
"csvtojson": "^2.0.10",
"exifr": "^7.1.3",
"image-size": "^1.1.1",
"ipx": "^3.0.1",
"prisma": "^5.20.0",
"rxjs": "^7.8.1",
"socket.io": "^4.8.0",
"zod": "^3.23.8",
"prisma": "^5.20.0"
"zod": "^3.23.8"
},
"devDependencies": {
"@nestjs/cli": "^10.4.5",
Expand Down
31 changes: 25 additions & 6 deletions backend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions backend/src/images/image.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ export class Image {
event: TrackEvent | null;
@ApiProperty({ type: () => [Athlete] })
athletes: Athlete[];
@ApiProperty()
width: number;
@ApiProperty()
height: number;
}

export class Athlete {
Expand Down
4 changes: 4 additions & 0 deletions backend/src/images/iptc.parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as exifr from 'exifr';
import * as csv from 'csvtojson';
import * as path from 'path';
import { Athlete, TrackEvent, Image } from './image.entity';
import sizeOf from 'image-size';

const captionSchema = z.object({
FirstName: z.string(),
Expand Down Expand Up @@ -43,6 +44,7 @@ export async function parseIptcFromFile(file: string): Promise<Image | null> {
const windSpeed = getWindSpeedFromCaption(parsedCaption);
const athletes = getAthletesFromCaption(parsedCaption);
const event = getEventFromTitle(title);
const { width, height } = sizeOf(file);
return {
lastModified,
filename: path.parse(file).base,
Expand All @@ -55,6 +57,8 @@ export async function parseIptcFromFile(file: string): Promise<Image | null> {
athletes,
windSpeed,
event,
width,
height,
};
}

Expand Down
3 changes: 2 additions & 1 deletion frontend/.env
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
VITE_PHOTOFINISH_API_URL=https://photofinish-api.lcrehlingen.de
VITE_PHOTOFINISH_WEBSOCKET_URL=https://photofinish-api.lcrehlingen.de
VITE_PHOTOFINISH_WEBSOCKET_URL=https://photofinish-api.lcrehlingen.de
VITE_IPX_URL=https://photofinish-api.lcrehlingen.de/_ipx/_/
3 changes: 2 additions & 1 deletion frontend/.env.development
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
VITE_PHOTOFINISH_API_URL=/api/photofinish
VITE_PHOTOFINISH_WEBSOCKET_URL=http://localhost:3000
VITE_PHOTOFINISH_WEBSOCKET_URL=http://localhost:3000
VITE_IPX_URL=http://localhost:3000/_ipx/_/
1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
},
"dependencies": {
"@generouted/react-router": "^1.19.6",
"@unpic/react": "^0.1.14",
"axios": "^1.7.7",
"qrcode": "^1.5.4",
"react": "^18.3.1",
Expand Down
31 changes: 31 additions & 0 deletions frontend/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

143 changes: 0 additions & 143 deletions frontend/src/components/Image.tsx

This file was deleted.

Loading

0 comments on commit 2c7013e

Please sign in to comment.