Merge branch '1354-image-compression-jpeg' into 'develop'
MediaUpload, Settings: Add option to always convert to jpeg. Closes #1354 See merge request pleroma/pleroma-fe!2019
This commit is contained in:
commit
cd46f324d2
5 changed files with 15 additions and 4 deletions
1
changelog.d/always-jpeg.add
Normal file
1
changelog.d/always-jpeg.add
Normal file
|
@ -0,0 +1 @@
|
|||
Added option to always convert images to JPEG format instead of using WebP when compressing images.
|
|
@ -76,9 +76,9 @@ const mediaUpload = {
|
|||
const testCanvas = document.createElement('canvas')
|
||||
const supportsWebP = testCanvas.toDataURL('image/webp').startsWith('data:image/webp')
|
||||
|
||||
// Convert to WebP if supported, otherwise JPEG
|
||||
const type = supportsWebP ? 'image/webp' : 'image/jpeg'
|
||||
const extension = supportsWebP ? '.webp' : '.jpg'
|
||||
// Convert to WebP if supported and alwaysUseJpeg is false, otherwise JPEG
|
||||
const type = (!this.$store.getters.mergedConfig.alwaysUseJpeg && supportsWebP) ? 'image/webp' : 'image/jpeg'
|
||||
const extension = type === 'image/webp' ? '.webp' : '.jpg'
|
||||
|
||||
// Remove the original extension and add new one
|
||||
const newFileName = file.name.replace(/\.[^/.]+$/, '') + extension
|
||||
|
|
|
@ -269,6 +269,14 @@
|
|||
{{ $t('settings.image_compression') }}
|
||||
</BooleanSetting>
|
||||
</li>
|
||||
<li>
|
||||
<BooleanSetting
|
||||
path="alwaysUseJpeg"
|
||||
expert="1"
|
||||
>
|
||||
{{ $t('settings.always_use_jpeg') }}
|
||||
</BooleanSetting>
|
||||
</li>
|
||||
<li>
|
||||
<BooleanSetting
|
||||
path="useContainFit"
|
||||
|
|
|
@ -440,6 +440,7 @@
|
|||
"attachmentRadius": "Attachments",
|
||||
"attachments": "Attachments",
|
||||
"image_compression": "Compress images before uploading",
|
||||
"always_use_jpeg": "Always convert images to JPEG format",
|
||||
"avatar": "Avatar",
|
||||
"avatarAltRadius": "Avatars (notifications)",
|
||||
"avatarRadius": "Avatars",
|
||||
|
|
|
@ -194,7 +194,8 @@ export const defaultState = {
|
|||
useAbsoluteTimeFormat: undefined, // instance default
|
||||
absoluteTimeFormatMinAge: undefined, // instance default
|
||||
absoluteTime12h: undefined, // instance default
|
||||
imageCompression: true
|
||||
imageCompression: true,
|
||||
alwaysUseJpeg: false
|
||||
}
|
||||
|
||||
// caching the instance default properties
|
||||
|
|
Loading…
Add table
Reference in a new issue