From e6637dcef307f4b2bd1122b28924b501f0fb991f Mon Sep 17 00:00:00 2001 From: curben <2809763-curben@users.noreply.gitlab.com> Date: Fri, 30 Aug 2019 04:31:44 +0100 Subject: [PATCH] refactor(cloudinary): use Statically Imgpx image resize function - https://developers.marsble.com/docs/imgpx --- scripts/cloudinary.js | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/scripts/cloudinary.js b/scripts/cloudinary.js index 1562d6a..b0de0b9 100644 --- a/scripts/cloudinary.js +++ b/scripts/cloudinary.js @@ -14,9 +14,7 @@ hexo.extend.tag.register('cloudinary', (args) => { const alt = args[1] || '' let modern = '' let legacy = '' - const cloudinary = 'https://cdn.statically.io/img/res.cloudinary.com/' + user + - '/image/upload/q_auto' - const original = 'https://cdn.statically.io/img/res.cloudinary.com/' + user + '/' + fileName + const link = 'https://cdn.statically.io/img/res.cloudinary.com/' + user if (fileName.endsWith('.png')) { modern = fileName.replace(/\.png$/, '.webp') @@ -28,26 +26,30 @@ hexo.extend.tag.register('cloudinary', (args) => { legacy = fileName } + fileName += '?auto_format=false' + modern += '?auto_format=false' + legacy += '?auto_format=false' + const img = `${alt}` if (fileName.endsWith('.png') || fileName.endsWith('.webp')) { - return ` + return `