File tree Expand file tree Collapse file tree 7 files changed +36
-20
lines changed Expand file tree Collapse file tree 7 files changed +36
-20
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ import Head from 'next/head';
44import ProxyImage , {
55 ImgProxyParamBuilder ,
66 buildProxyImagePath ,
7+ ResizeType ,
8+ GravityType ,
79} from '../../dist' ;
810
911const demoContent : {
@@ -65,12 +67,12 @@ const demoContent: {
6567 height : 100 ,
6668 proxyParams : new ImgProxyParamBuilder ( )
6769 . resize ( {
68- type : 'fit' ,
70+ type : ResizeType . FILL ,
6971 width : 100 ,
7072 height : 100 ,
7173 enlarge : true ,
7274 gravity : {
73- type : 'no' ,
75+ type : GravityType . NORTH ,
7476 center : {
7577 x : 10 ,
7678 y : 10 ,
Original file line number Diff line number Diff line change 11{
22 "name" : " @bitpatty/next-image-s3-imgproxy-loader" ,
3- "version" : " 0.1.1 " ,
3+ "version" : " 0.2.0 " ,
44 "description" : " imgproxy S3 extension for next/image" ,
55 "author" : " Matteias Collet <matteias.collet@bluewin.ch>" ,
66 "main" : " dist/index.js" ,
Original file line number Diff line number Diff line change 1+ enum GravityType {
2+ NORTH = 'no' ,
3+ SOUTH = 'so' ,
4+ EAST = 'ea' ,
5+ WEST = 'we' ,
6+ NORTHEAST = 'noea' ,
7+ NORTHWEST = 'nowe' ,
8+ SOUTHEAST = 'soea' ,
9+ SOUTHWEST = 'sowe' ,
10+ CENTER = 'center' ,
11+ }
12+
13+ export default GravityType ;
Original file line number Diff line number Diff line change 1+ enum ResizeType {
2+ FIT = 'fit' ,
3+ FILL = 'fill' ,
4+ AUTO = 'auto' ,
5+ }
6+
7+ export default ResizeType ;
Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ import { request as httpsRequest } from 'https';
77import { ServerResponse , request as httpRequest } from 'http' ;
88
99import ImgProxyParamBuilder from './param-builder' ;
10+ import GravityType from './enums/gravity-type.enum' ;
11+ import ResizeType from './enums/resize-type.enum' ;
1012
1113const IMGPROXY_ENDPOINT = '/_next/imgproxy' ;
1214
@@ -119,8 +121,10 @@ const ProxyImage = ({
119121
120122export default ProxyImage ;
121123export {
124+ IMGPROXY_ENDPOINT ,
122125 buildProxyImagePath ,
123126 imageOptimizer ,
124- IMGPROXY_ENDPOINT ,
125127 ImgProxyParamBuilder ,
128+ GravityType ,
129+ ResizeType ,
126130} ;
Original file line number Diff line number Diff line change 1- type ResizeType = 'fit' | 'fill' | 'auto' ;
2-
3- type GravityType =
4- | 'no'
5- | 'so'
6- | 'ea'
7- | 'we'
8- | 'noea'
9- | 'nowe'
10- | 'soea'
11- | 'sowe'
12- | 'ce' ;
1+ import GravityType from './enums/gravity-type.enum' ;
2+ import ResizeType from './enums/resize-type.enum' ;
133
144type ForwardType = Partial < ImgProxyParamBuilder > & {
155 modifiers : string [ ] ;
@@ -36,7 +26,7 @@ class ImgProxyParamBuilder {
3626 enlarge ?: boolean ;
3727 extend ?: boolean ;
3828 gravity ?: {
39- type : Omit < GravityType , 'sm' > ;
29+ type : GravityType ;
4030 center ?: {
4131 x : number ;
4232 y : number ;
@@ -49,7 +39,7 @@ class ImgProxyParamBuilder {
4939 options
5040 ? [
5141 'resize' ,
52- type ?? 'fit' ,
42+ type ?? ResizeType . FIT ,
5343 width ?? 0 ,
5444 height ?? 0 ,
5545 ! ! enlarge ,
You can’t perform that action at this time.
0 commit comments