upload: Add support for removing built-in presets
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded
This commit is contained in:
parent
fda0b7e498
commit
9b227ead62
2 changed files with 20 additions and 16 deletions
|
@ -130,6 +130,10 @@ export default class Client {
|
|||
return str;
|
||||
}
|
||||
|
||||
get(url) {
|
||||
return this.customRequest('GET', url, null)
|
||||
}
|
||||
|
||||
post(url, body) {
|
||||
let parsed = JSON.stringify(body)
|
||||
return this.customRequest('POST', url, parsed, {
|
||||
|
|
|
@ -9,9 +9,9 @@ export function uploadMedia(file) {
|
|||
|
||||
let out = {
|
||||
sizes: {
|
||||
small: {},
|
||||
medium: {},
|
||||
large: {},
|
||||
small: media.small ? {} : null,
|
||||
medium: media.medium ? {} : null,
|
||||
large: media.large ? {} : null,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,33 +20,33 @@ export function uploadMedia(file) {
|
|||
filename: file.name,
|
||||
} }, 'POST', {
|
||||
preview: media.preview,
|
||||
small: media.small.avif,
|
||||
medium: media.medium.avif,
|
||||
large: media.large.avif,
|
||||
small: media.small?.avif,
|
||||
medium: media.medium?.avif,
|
||||
large: media.large?.avif,
|
||||
/*
|
||||
|
||||
small: media.small.jpeg,
|
||||
medium: media.medium.avif,
|
||||
large_jpeg: media.large.jpeg,*/
|
||||
large_jpeg: mediakl.large.jpeg,*/
|
||||
}).then(res => {
|
||||
out.filename = res.filename
|
||||
out.path = res.path
|
||||
out.preview = res.preview
|
||||
out.sizes.small.avif = res.small
|
||||
out.sizes.medium.avif = res.medium
|
||||
out.sizes.large.avif = res.large
|
||||
if (out.sizes.small) { out.sizes.small.avif = res.small }
|
||||
if (out.sizes.medium) { out.sizes.medium.avif = res.medium }
|
||||
if (out.sizes.large) { out.sizes.large.avif = res.large }
|
||||
out.size = file.size
|
||||
out.type = file.type
|
||||
|
||||
return client.post(media.path + '/' + out.filename + '?token=' + token, {
|
||||
small: media.small.jpeg,
|
||||
medium: media.medium.jpeg,
|
||||
large: media.large.jpeg,
|
||||
small: media.small?.jpeg,
|
||||
medium: media.medium?.jpeg,
|
||||
large: media.large?.jpeg,
|
||||
})
|
||||
.then(res => {
|
||||
out.sizes.small.jpeg = res.small
|
||||
out.sizes.medium.jpeg = res.medium
|
||||
out.sizes.large.jpeg = res.large
|
||||
if (out.sizes.small) { out.sizes.small.jpeg = res.small }
|
||||
if (out.sizes.medium) { out.sizes.medium.jpeg = res.medium }
|
||||
if (out.sizes.large) { out.sizes.large.jpeg = res.large }
|
||||
})
|
||||
})
|
||||
.then(() => {
|
||||
|
|
Loading…
Reference in a new issue