1
0
Fork 0
mirror of https://github.com/plankanban/planka.git synced 2025-07-18 20:59:44 +02:00

feat: Preserve original format of images, change interpolation kernel

Closes #349
This commit is contained in:
Maksim Eltyshev 2022-12-24 00:47:59 +01:00
parent 73abed65b5
commit 05b57142f9
17 changed files with 212 additions and 103 deletions

View file

@ -49,10 +49,10 @@ module.exports = {
customToJSON() {
return {
..._.omit(this, ['dirname', 'filename']),
..._.omit(this, ['dirname', 'filename', 'image.thumbnailsExtension']),
url: `${sails.config.custom.attachmentsUrl}/${this.id}/download/${this.filename}`,
coverUrl: this.image
? `${sails.config.custom.attachmentsUrl}/${this.id}/download/thumbnails/cover-256.jpg`
? `${sails.config.custom.attachmentsUrl}/${this.id}/download/thumbnails/cover-256.${this.image.thumbnailsExtension}`
: null,
};
},

View file

@ -54,11 +54,9 @@ module.exports = {
background: {
type: 'json',
},
backgroundImageDirname: {
type: 'string',
isNotEmptyString: true,
allowNull: true,
columnName: 'background_image_dirname',
backgroundImage: {
type: 'json',
columnName: 'background_image',
},
// ╔═╗╔╦╗╔╗ ╔═╗╔╦╗╔═╗
@ -82,10 +80,10 @@ module.exports = {
customToJSON() {
return {
..._.omit(this, ['backgroundImageDirname']),
backgroundImage: this.backgroundImageDirname && {
url: `${sails.config.custom.projectBackgroundImagesUrl}/${this.backgroundImageDirname}/original.jpg`,
coverUrl: `${sails.config.custom.projectBackgroundImagesUrl}/${this.backgroundImageDirname}/cover-336.jpg`,
..._.omit(this, ['backgroundImage']),
backgroundImage: this.backgroundImage && {
url: `${sails.config.custom.projectBackgroundImagesUrl}/${this.backgroundImage.dirname}/original.${this.backgroundImage.extension}`,
coverUrl: `${sails.config.custom.projectBackgroundImagesUrl}/${this.backgroundImage.dirname}/cover-336.${this.backgroundImage.extension}`,
},
};
},

View file

@ -37,11 +37,8 @@ module.exports = {
regex: /^[a-zA-Z0-9]+((_|\.)?[a-zA-Z0-9])*$/,
allowNull: true,
},
avatarDirname: {
type: 'string',
isNotEmptyString: true,
allowNull: true,
columnName: 'avatar_dirname',
avatar: {
type: 'json',
},
phone: {
type: 'string',
@ -106,10 +103,10 @@ module.exports = {
customToJSON() {
return {
..._.omit(this, ['password', 'avatarDirname', 'passwordChangedAt']),
..._.omit(this, ['password', 'avatar', 'passwordChangedAt']),
avatarUrl:
this.avatarDirname &&
`${sails.config.custom.userAvatarsUrl}/${this.avatarDirname}/square-100.jpg`,
this.avatar &&
`${sails.config.custom.userAvatarsUrl}/${this.avatar.dirname}/square-100.${this.avatar.extension}`,
};
},
};