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