mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-09-08 17:08:49 +08:00
✨ Feature(custom): support avif picture preview
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 5.3 KiB |
@@ -21,6 +21,7 @@ export const availableIconList = [
|
||||
'au',
|
||||
'avc',
|
||||
'avi',
|
||||
'avif',
|
||||
'avs',
|
||||
'bak',
|
||||
'bas',
|
||||
|
||||
@@ -66,14 +66,15 @@ export function encodeFilePath(filePath: string) {
|
||||
export const getExtension = (fileName: string) => path.extname(fileName).slice(1)
|
||||
|
||||
export const isImage = (fileName: string) =>
|
||||
['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp', 'ico', 'svg'].includes(getExtension(fileName))
|
||||
['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp', 'ico', 'svg', 'avif'].includes(getExtension(fileName))
|
||||
|
||||
export const formatEndpoint = (endpoint: string, sslEnabled: boolean): string =>
|
||||
!/^https?:\/\//.test(endpoint)
|
||||
? `${sslEnabled ? 'https' : 'http'}://${endpoint}`
|
||||
: sslEnabled
|
||||
? endpoint.replace('http://', 'https://')
|
||||
: endpoint.replace('https://', 'http://')
|
||||
export const formatEndpoint = (endpoint: string, sslEnabled: boolean): string => {
|
||||
const hasProtocol = /^https?:\/\//.test(endpoint)
|
||||
if (!hasProtocol) {
|
||||
return `${sslEnabled ? 'https' : 'http'}://${endpoint}`
|
||||
}
|
||||
return sslEnabled ? endpoint.replace(/^http:\/\//, 'https://') : endpoint.replace(/^https:\/\//, 'http://')
|
||||
}
|
||||
|
||||
export const trimPath = (path: string) => path.replace(/^\/+|\/+$/g, '').replace(/\/+/g, '/')
|
||||
|
||||
|
||||
+5
-4
@@ -3,10 +3,11 @@
|
||||
### 图片
|
||||
|
||||
| 格式 | 描述 | 格式 | 描述 |
|
||||
| :-----------------------------------------------------: | :----------: | :-------------------------------------------------------------: | :----------------: |
|
||||
| [.bmp](https://en.wikipedia.org/wiki/BMP_file_format) | 位图文件格式 | [.jpeg/.jpg](https://en.wikipedia.org/wiki/JPEG) | 联合照片专家组格式 |
|
||||
| [.gif](https://en.wikipedia.org/wiki/GIF) | 图形交换格式 | [.png](https://en.wikipedia.org/wiki/Portable_Network_Graphics) | 可移植网络图形格式 |
|
||||
| [.ico](https://en.wikipedia.org/wiki/ICO_(file_format)) | 图标文件格式 | [.webp](https://developers.google.com/speed/webp/) | WebP格式 |
|
||||
| :---: | :----------: | :--------: | :----------------: |
|
||||
| .bmp | 位图文件格式 | .jpeg/.jpg | 联合照片专家组格式 |
|
||||
| .gif | 图形交换格式 | .png | 可移植网络图形格式 |
|
||||
| .ico | 图标文件格式 | .webp | WebP格式 |
|
||||
| .svg | 可缩放矢量图 | .avif | AVIF格式 |
|
||||
|
||||
### 文本
|
||||
|
||||
|
||||
Reference in New Issue
Block a user