Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F9583368
imageRouter.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
imageRouter.ts
View Options
import
sharp
from
"sharp"
;
import
{
DirectCropOptions
,
SmartCropOptions
}
from
"../utils/smartCropImage"
;
export
type
CropDescription
=
SmartCropOptions
|
DirectCropOptions
|
false
;
export
type
BaseImageParameters
=
{
alt
:
string
;
lossless
:
boolean
;
lazy
:
boolean
;
imgStyle
:
string
;
style
:
string
;
targetRatio
:
number
;
ratioDiffThreshold
:
number
;
crop
:
CropDescription
;
thumbnailSize
:
number
;
};
type
sizesAttr
=
{
sizesAttr
:
string
;
};
export
type
Container
=
{
objectFit
?:
"cover"
|
"contain"
;
width
:
number
;
height
:
number
;
};
type
resolutions
=
{
resolutions
:
number
[];
};
export
type
ImageParameters
=
(
Partial
<
BaseImageParameters
>
&
(
|
(
sizesAttr
&
resolutions
)
|
sizesAttr
|
(
resolutions
&
{
container
:
Container
})
|
{
container
:
Container
}
))
&
{
alt
:
string
};
export
type
Task
=
{
hash
:
string
;
resolution
:
number
;
fileExtension
:
string
;
crop
:
SmartCropOptions
|
DirectCropOptions
|
undefined
;
};
export
type
correctExtension
=
"jpeg"
|
"png"
|
"avif"
|
"webp"
;
export
type
ImageData
=
{
resolutions
:
number
[];
lossless
:
boolean
;
originalPath
:
string
;
targetRatio
:
number
;
ratioDiffThreshold
:
number
;
container
:
Container
;
crop
:
CropDescription
;
thumbnailSize
:
number
;
};
export
type
ImageRatioClass
=
|
"horizontal"
|
"vertical"
|
"square"
|
"landscape"
|
"portrait"
|
"ratio-crossed-threshold"
|
"ratio-above-threshold"
|
"ratio-below-threshold"
;
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Sat, Oct 11, 09:31 (8 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
982407
Default Alt Text
imageRouter.ts (1 KB)
Attached To
Mode
rRIMAGEROUTER koa-responsive-image-router
Attached
Detach File
Event Timeline
Log In to Comment