Skip to content

Commit dc1e21b

Browse files
committed
feat(): add dynamic image sizing using sharp
1 parent 12e8adc commit dc1e21b

File tree

4 files changed

+505
-6
lines changed

4 files changed

+505
-6
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ The project is built using MSW and can be run directly on a local machine or in
1515
The framework is written in TypeScript and can :
1616

1717
- Serve data from static files (JSON or text)
18-
- Serve media : Images and Videos
18+
- Serve media : Images (which can be dynamically resized using url parameters) and Videos
1919
- Serve markdown files
2020
- Be used to write and test AWS Lambda Functions
2121
- Use custom middleware to transform input/output
@@ -253,6 +253,15 @@ and
253253
http://localhost:8000/api/videos/placeholder.mp4
254254
```
255255

256+
#### 9.1 Resizing images
257+
258+
Images should be saved in PNG format. To get an image of any required size, pass the pixel width and height in the url parameters.
259+
Note: both a height AND a width need to be passed for the image to resize otherwise the default size is used.
260+
261+
```
262+
http://localhost:8000/api/images/placeholder.png?width=300&height=500
263+
```
264+
256265
### 10. Markdown
257266

258267
Markdown can be served from the markdown folder in src/resources/markdown and supports code highlighting. Note the url doesn't need to include .md

0 commit comments

Comments
 (0)