diff options
| author | Mitja Felicijan <mitja.felicijan@gmail.com> | 2020-03-29 03:17:09 +0200 |
|---|---|---|
| committer | Mitja Felicijan <mitja.felicijan@gmail.com> | 2020-03-29 03:17:09 +0200 |
| commit | 1647071aa7d56f6b2e63153b1bc13d112229d6a1 (patch) | |
| tree | b42946c49b001d99a6a1e3e751cacd3e83d275f9 /content/2020-03-27-create-placeholder-images-with-sharp.md | |
| parent | c070cca569780abc2408b8e6c8841fb6cbf9effe (diff) | |
| download | mitjafelicijan.com-1647071aa7d56f6b2e63153b1bc13d112229d6a1.tar.gz | |
Adde blockquotes styles
Diffstat (limited to 'content/2020-03-27-create-placeholder-images-with-sharp.md')
| -rw-r--r-- | content/2020-03-27-create-placeholder-images-with-sharp.md | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/content/2020-03-27-create-placeholder-images-with-sharp.md b/content/2020-03-27-create-placeholder-images-with-sharp.md index 1386b2f..ec6fadd 100644 --- a/content/2020-03-27-create-placeholder-images-with-sharp.md +++ b/content/2020-03-27-create-placeholder-images-with-sharp.md | |||
| @@ -49,7 +49,7 @@ All this code was wrapped inside a web service with some additional security che | |||
| 49 | 49 | ||
| 50 | And at that point I needed to return placeholder images as a response in case key is missing or x,y are not allowed by the server etc. I could have created PNG in Gimp and just serve them but I wanted to respect aspect ratio and I didn't want to return some mangled images. | 50 | And at that point I needed to return placeholder images as a response in case key is missing or x,y are not allowed by the server etc. I could have created PNG in Gimp and just serve them but I wanted to respect aspect ratio and I didn't want to return some mangled images. |
| 51 | 51 | ||
| 52 | **ⓘ** Main problem with finding a clean solution I could copy and paste and change a bit was a task. API is changing constantly and there weren't clear examples or I was unable to find them. | 52 | > Main problem with finding a clean solution I could copy and paste and change a bit was a task. API is changing constantly and there weren't clear examples or I was unable to find them. |
| 53 | 53 | ||
| 54 | ## Generating placeholder images using SVG | 54 | ## Generating placeholder images using SVG |
| 55 | 55 | ||
| @@ -80,4 +80,4 @@ const generatePlaceholderImageWithText = async (width, height, message) => { | |||
| 80 | 80 | ||
| 81 | That is about it. Nothing more to it. You can change the color of the image by changing `background` and if you want to change text styling you can adapt SVG to your needs. | 81 | That is about it. Nothing more to it. You can change the color of the image by changing `background` and if you want to change text styling you can adapt SVG to your needs. |
| 82 | 82 | ||
| 83 | **ⓘ** Also be careful about the length of the text. This function positions text at the center and adds `20px` padding on all sides. If text is longer than the image it will get cut. | 83 | > Also be careful about the length of the text. This function positions text at the center and adds `20px` padding on all sides. If text is longer than the image it will get cut. |
