Auto remove leading dot in image extension

This commit is contained in:
the1812 2019-10-26 11:02:17 +08:00
parent 71a5ca703b
commit 742eb05d6b
5 changed files with 15 additions and 0 deletions

View File

@ -154,6 +154,9 @@ const formatDuration = (time, fixed = 0) => {
}
const getDpiSourceSet = (src, baseSize, extension = 'jpg') => {
const dpis = [1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4]
if (extension.startsWith('.')) {
extension = extension.substring(1)
}
return dpis.map(dpi => {
if (typeof baseSize === 'object') {
if ('width' in baseSize && 'height' in baseSize) {

View File

@ -154,6 +154,9 @@ const formatDuration = (time, fixed = 0) => {
}
const getDpiSourceSet = (src, baseSize, extension = 'jpg') => {
const dpis = [1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4]
if (extension.startsWith('.')) {
extension = extension.substring(1)
}
return dpis.map(dpi => {
if (typeof baseSize === 'object') {
if ('width' in baseSize && 'height' in baseSize) {

View File

@ -153,6 +153,9 @@ const formatDuration = (time, fixed = 0) => {
}
const getDpiSourceSet = (src, baseSize, extension = 'jpg') => {
const dpis = [1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4]
if (extension.startsWith('.')) {
extension = extension.substring(1)
}
return dpis.map(dpi => {
if (typeof baseSize === 'object') {
if ('width' in baseSize && 'height' in baseSize) {

View File

@ -153,6 +153,9 @@ const formatDuration = (time, fixed = 0) => {
}
const getDpiSourceSet = (src, baseSize, extension = 'jpg') => {
const dpis = [1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4]
if (extension.startsWith('.')) {
extension = extension.substring(1)
}
return dpis.map(dpi => {
if (typeof baseSize === 'object') {
if ('width' in baseSize && 'height' in baseSize) {

View File

@ -117,6 +117,9 @@ export const formatDuration = (time, fixed = 0) => {
}
export const getDpiSourceSet = (src, baseSize, extension = 'jpg') => {
const dpis = [1, 1.25, 1.5, 1.75, 2, 2.25, 2.5, 2.75, 3, 3.25, 3.5, 3.75, 4]
if (extension.startsWith('.')) {
extension = extension.substring(1)
}
return dpis.map(dpi => {
if (typeof baseSize === 'object') {
if ('width' in baseSize && 'height' in baseSize) {