From 1d80940bf4f654b130f729cd071fd6ad3780b68d Mon Sep 17 00:00:00 2001 From: feruz Date: Mon, 16 Dec 2019 07:42:11 +0200 Subject: [PATCH] resizing issue fix --- src/utils/image.js | 4 ++-- src/utils/postParser.js | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/utils/image.js b/src/utils/image.js index c236b64ac..b3074341d 100644 --- a/src/utils/image.js +++ b/src/utils/image.js @@ -76,11 +76,11 @@ export const getResizedImage = (url, size = 640) => { } if (url.includes('img.esteem.ws')) { - return `https://img.esteem.ws/${size}x0/${url}`; + return `${url.replace('img.esteem.ws/', `img.esteem.ws/${size}/`)}`; } if (url.includes('img.esteem.app')) { - return `https://img.esteem.app/${size}x0/${url}`; + return `${url.replace('img.esteem.app/', `img.esteem.app/${size}/`)}`; } return `https://steemitimages.com/${size}x0/${url}`; diff --git a/src/utils/postParser.js b/src/utils/postParser.js index 33b9f5003..3aac618ae 100644 --- a/src/utils/postParser.js +++ b/src/utils/postParser.js @@ -70,10 +70,9 @@ const postImage = (metaData, body) => { const urlRegex = /(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?/gm; const imageRegex = /(http(s?):)([/|.|\w|\s|-])*\.(?:jpg|gif|png)/g; let imageLink; - if (metaData && metaData.image && metaData.image[0]) { [imageLink] = metaData.image; - } else if (body && markdownImageRegex.test(body)) { + } else if (!imageLink && body && markdownImageRegex.test(body)) { const markdownMatch = body.match(markdownImageRegex); if (markdownMatch[0]) { const firstMarkdownMatch = markdownMatch[0];