Installations
npm install next-image-meta-loader
Developer Guide
Typescript
No
Module System
CommonJS
Min. Node Version
>= 10.13.0
Node Version
14.15.4
NPM Version
6.14.10
Score
42.8
Supply Chain
62.6
Quality
70.2
Maintenance
50
Vulnerability
97.9
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (69.67%)
JavaScript (30.33%)
Developer
tinialabs
Download Statistics
Total Downloads
1,136
Last Day
1
Last Week
4
Last Month
20
Last Year
229
GitHub Statistics
5 Stars
1 Commits
2 Watching
1 Branches
1 Contributors
Package Meta Information
Latest Version
2.0.0
Package Id
next-image-meta-loader@2.0.0
Unpacked Size
22.30 kB
Size
6.54 kB
File Count
8
NPM Version
6.14.10
Node Version
14.15.4
Total Downloads
Cumulative downloads
Total Downloads
1,136
Last day
0%
1
Compared to previous day
Last week
100%
4
Compared to previous week
Last month
17.6%
20
Compared to previous month
Last year
4.1%
229
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
3
Peer Dependencies
1
Dev Dependencies
3
next-image-meta-loader
Features:
- Enhanced file-loader Loads image assets directly into Next.js public folder no matter where the source file is
- Sizing Looks up the size of the image and provides height, width and aspect ratio, for use in
next/image
and other optimizers (to prevent layout shift) - Rotates using EXIF data Before saving the image, rotates it using the EXIF data portrait/landscape if appropriate
- Generates LQIP Calculates a 16px low quality image placeholder and provides as a BASE 64 data string to be embedded directly in HTML
- Returns Meta Data Turns any
import
orrequire
statement into an object that contains not only the file name but all the above meta data; works both server side and client side in Next.JS, compatible with SSG and SSR
Table of contents
Installation
npm install next-image-meta-loader next-compose-plugins
Add the plugin with next-compose-plugins
to your Next.js configuration:
1// next.config.js 2const withPlugins = require("next-compose-plugins"); 3const nextImageMetaLoader = require("next-image-meta-loader"); 4 5module.exports = withPlugins([ 6 nextImageMetaLoader 7 // your other plugins here 8]);
Options
Option | Default | Type | Description |
---|---|---|---|
contentThemeFolder | './content/theme' | string | The folder where theme files including favicon are kept |
imageMetaOutput | './static/media' | string | The public folder where all output will be placed |
imageMetaExtensions | ['svg', 'png', 'jpe?g', 'gif', 'mp4'] | Array | The list of extensions to process |
imageMetaName | '[name].[hash].[ext]' | string | The naming convention of the output files |
Usage
You can now simply import images in your projects directly from source folders.
1 const meta = require('./images/narative-output.png') 2 3 /** meta now contains: { 4 width: 800, 5 height: 600 6 aspectRatio: 1.25, 7 blurWidth: 16, 8 blurHeight: 13, 9 lqip: 'data:image/webp;base64,XXXXXXXX', 10 src: 'static/media/XXXXX' // actual location of file in the Next.js public folder 11 } 12 */
With the right mdx component that does a require like the above, you can also include directly in MDX and get the advantage of lqip, lazy loading, next.js image optimization etc.. See next-theme-novela for an example of such an Image
component.
1![This is the alt text](./images/narative-output.png)
License
Licensed under the MIT license.
© Copyright Guy Barnard and Tinia Labs contributors
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
Found 0/1 approved changesets -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'main'
Score
3
/10
Last Scanned on 2024-12-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More