페이지 커버 썸네일 최적화
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
const postCardThumbnailUrlPattern = /^\/uploads\/posts\/\d{4}\/\d{2}\/thumbs\/[^/?#]+-card\.webp$/i
|
||||
const pageCoverThumbnailUrlPattern = /^\/uploads\/posts\/\d{4}\/\d{2}\/thumbs\/[^/?#]+-page-cover\.webp$/i
|
||||
const postBodyThumbnailUrlPattern = /^\/uploads\/posts\/\d{4}\/\d{2}\/thumbs\/[^/?#]+-(?:body(?:-720)?|lightbox)\.webp$/i
|
||||
const postUploadImageUrlPattern = /^\/uploads\/posts\/\d{4}\/\d{2}\/[^/?#]+\.(?:jpe?g|png|webp)$/i
|
||||
|
||||
@@ -33,6 +34,15 @@ export const isPostCardThumbnailUrl = (imageUrl) => Boolean(
|
||||
imageUrl && postCardThumbnailUrlPattern.test(String(imageUrl))
|
||||
)
|
||||
|
||||
/**
|
||||
* 페이지 커버 썸네일 URL인지 확인한다.
|
||||
* @param {string|null|undefined} imageUrl - 검사할 이미지 URL
|
||||
* @returns {boolean} 페이지 커버 썸네일 여부
|
||||
*/
|
||||
export const isPageCoverThumbnailUrl = (imageUrl) => Boolean(
|
||||
imageUrl && pageCoverThumbnailUrlPattern.test(String(imageUrl))
|
||||
)
|
||||
|
||||
/**
|
||||
* 게시물 본문 표시용 파생 이미지 URL인지 확인한다.
|
||||
* @param {string|null|undefined} imageUrl - 검사할 이미지 URL
|
||||
@@ -62,3 +72,10 @@ export const getPostBodyPreviewThumbnailUrl = (imageUrl) => getPostDerivativeIma
|
||||
* @returns {string} 라이트박스용 파생 이미지 URL
|
||||
*/
|
||||
export const getPostLightboxThumbnailUrl = (imageUrl) => getPostDerivativeImageUrl(imageUrl, 'lightbox')
|
||||
|
||||
/**
|
||||
* 페이지 커버 원본 이미지 URL에 대응하는 홈 진열장 썸네일 URL을 만든다.
|
||||
* @param {string|null|undefined} imageUrl - 원본 이미지 URL
|
||||
* @returns {string} 페이지 커버 썸네일 URL
|
||||
*/
|
||||
export const getPageCoverThumbnailUrl = (imageUrl) => getPostDerivativeImageUrl(imageUrl, 'page-cover')
|
||||
|
||||
Reference in New Issue
Block a user