-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: cover image * refactor(ogImage): use pwa module meta config * ci: nuxt generate rather than export * chore(env): VERCEL_GITHUB_COMMIT_SHA * chore: remove dotenv * fix(env): base url force protocol Co-authored-by: Damien Robinson <damien.robinson@xcommedia.com.au>
- Loading branch information
1 parent
07f1558
commit a8b5b42
Showing
10 changed files
with
87 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+6.17 MB
(980%)
assets/img/portfolio/brisbane-city-council-free-native-plants.daim.dev_species.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,43 @@ | ||
const { readdir } = require('fs').promises; | ||
const { resolve } = require('path'); | ||
const sharp = require('sharp'); | ||
|
||
/** | ||
* https://stackoverflow.com/questions/5827612/node-js-fs-readdir-recursive-directory-search | ||
* @param {String} dir | ||
*/ | ||
async function* getFiles(dir) { | ||
const dirents = await readdir(dir, { withFileTypes: true }); | ||
for (const dirent of dirents) { | ||
const res = resolve(dir, dirent.name); | ||
if (dirent.isDirectory()) { | ||
yield* getFiles(res); | ||
} else { | ||
yield res; | ||
} | ||
} | ||
} | ||
|
||
const file = 'assets/img/header-bg.jpg'; | ||
sharp(file) | ||
.resize(4686) | ||
.toFile(`assets/img/header-bg-1.jpg`, (err, info) => { | ||
console.log(err, info); | ||
}); | ||
|
||
sharp(file) | ||
.resize({ width: 1200, height: 600 }) | ||
.toFile(`static/cover.jpg`, (err, info) => { | ||
console.log(err, info); | ||
}); | ||
|
||
(async () => { | ||
const folder = 'assets/img/portfolio'; | ||
// get list of urls to crawl from content files | ||
for await (const filename of getFiles(folder)) { | ||
const buffer = await sharp(filename) | ||
.resize({ width: 4686, height: 2636 }) | ||
.toBuffer(); | ||
sharp(buffer).toFile(filename); | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
a8b5b42
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs: