Skip to content

Commit

Permalink
[adjust] width rename to thumb_size
Browse files Browse the repository at this point in the history
  • Loading branch information
VecHK committed Jan 6, 2024
1 parent 56c4a12 commit 9c48a4b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions dashboard/src/components/UploadImageBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
default: ''
},
width: {
thumbSize: {
type: Number,
default: 0
},
Expand All @@ -164,8 +164,8 @@
computed: {
upload_url() {
const base_url = `${process.env.VUE_APP_BASE_API}admin/image/upload`
if (this.width !== 0) {
return `${base_url}?width=${this.width}`
if (this.thumbSize !== 0) {
return `${base_url}?thumb_size=${this.thumbSize}`
} else {
return base_url
}
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/views/member/detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
>
<UploadImageBox
ref="UploadImageBox"
:width="128"
:thumb-size="128"
:preview-url="preview_url"
@upload-success="uploadSuccess"
/>
Expand Down
2 changes: 1 addition & 1 deletion server/app/controller/admin/image.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ module.exports = app => {

async upload(ctx) {
const stream = await ctx.getFileStream();
const thumb_size = this.thumbSize(ctx.query.width);
const thumb_size = this.thumbSize(ctx.query.thumb_size);
try {
const {
imagePath, imageThumbPath, src, thumb,
Expand Down
2 changes: 1 addition & 1 deletion server/test/image-upload.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ describe('controller/admin/image', function () {
const spec_width = 32
const { app, token } = await constructPlainEnvironment(true)
const { body: img } = await app.httpRequest()
.post(`/admin/image/upload?width=${spec_width}`)
.post(`/admin/image/upload?thumb_size=${spec_width}`)
.set('Authorization', token)
.field('name', `image-${Date.now()}`)
.attach('image', test_avatar_image_path)
Expand Down

0 comments on commit 9c48a4b

Please sign in to comment.