back to jpeg

This commit is contained in:
les
2020-07-08 23:02:08 +02:00
parent 5a5c62efb4
commit fe4ed2cde7
5 changed files with 93 additions and 109 deletions

View File

@@ -74,7 +74,7 @@ Event.prototype.toAP = function (username, locale, to = []) {
if (this.image_path) {
attachment.push({
type: 'Document',
mediaType: 'image/webp',
mediaType: 'image/jpeg',
url: `${config.baseurl}/media/${this.image_path}`,
name: null,
blurHash: null

View File

@@ -14,14 +14,14 @@ try {
const DiskStorage = {
_handleFile (req, file, cb) {
const filename = crypto.randomBytes(16).toString('hex') + '.webp'
const filename = crypto.randomBytes(16).toString('hex') + '.jpg'
const finalPath = path.resolve(config.upload_path, filename)
const thumbPath = path.resolve(config.upload_path, 'thumb', filename)
const outStream = fs.createWriteStream(finalPath)
const thumbStream = fs.createWriteStream(thumbPath)
const resizer = sharp().resize(1200).webp({ quality: 95 })
const thumbnailer = sharp().resize(400).webp({ quality: 90 })
const resizer = sharp().resize(1200).jpeg({ quality: 95 })
const thumbnailer = sharp().resize(400).jpeg({ quality: 90 })
let onError = false
const err = e => {
if (onError) {

View File

@@ -69,14 +69,14 @@ module.exports = {
async getImageFromURL (url) {
debug(`getImageFromURL ${url}`)
const filename = crypto.randomBytes(16).toString('hex') + '.webp'
const filename = crypto.randomBytes(16).toString('hex') + '.jpg'
const finalPath = path.resolve(config.upload_path, filename)
const thumbPath = path.resolve(config.upload_path, 'thumb', filename)
const outStream = fs.createWriteStream(finalPath)
const thumbStream = fs.createWriteStream(thumbPath)
const resizer = sharp().resize(1200).webp({ quality: 95 })
const thumbnailer = sharp().resize(400).webp({ quality: 90 })
const resizer = sharp().resize(1200).jpg({ quality: 95 })
const thumbnailer = sharp().resize(400).jpg({ quality: 90 })
const response = await axios({ method: 'GET', url, responseType: 'stream' })