Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ thumbnail_light.png (for light theme) and thumbnail_dark.png (for dark theme)
These images must be exactly 160x160 pixels. They are displayed in the grid list view.
#### 3. Banners
banner_light.png (for light theme) and banner_dark.png (for dark theme)
These images must be no larger than 274x105 pixels. They are used when your product appears in the featured carousel.
These images must be no larger than 274px wide. But **must** be 60px high. They are used when your product appears in the featured carousel.

Note: Files ending with `_light.png` are for the light theme, and those ending with `_dark.png` are for the dark theme.

Expand Down
Binary file modified partners/Stakeflow/banner_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified partners/Stakeflow/banner_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified partners/SubQuery Decentralised RPCs/banner_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified partners/VIA Labs/banner_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified partners/VIA Labs/banner_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified partners/Web3CDN/banner_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified partners/Web3CDN/banner_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified partners/chorus-one/banner_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified partners/chorus-one/banner_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion scripts/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ export const maxNumberOfTags = 3
export const maxThumbnailWidth = 160
export const maxThumbnailHeight = 160
export const maxBannerWidth = 274
export const maxBannerHeight = 105
export const maxBannerHeight = 60
53 changes: 44 additions & 9 deletions scripts/validate-partners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ export async function validatePartnerInfo(partnerPath: string): Promise<string[]
}

errorMessages = errorMessages.concat(await checkImageDimensionsExact(fullThumbnailPathLight, maxThumbnailWidth, maxThumbnailHeight));
errorMessages = errorMessages.concat(await checkImageDimensions(fullBannerPathLight, maxBannerWidth, maxBannerHeight));
errorMessages = errorMessages.concat(await checkImageDimensions(fullBannerPathLight, maxBannerWidth, maxBannerHeight, false, true));

errorMessages = errorMessages.concat(await checkImageDimensionsExact(fullThumbnailPathDark, maxThumbnailWidth, maxThumbnailHeight));
errorMessages = errorMessages.concat(await checkImageDimensions(fullBannerPathDark, maxBannerWidth, maxBannerHeight));
errorMessages = errorMessages.concat(await checkImageDimensions(fullBannerPathDark, maxBannerWidth, maxBannerHeight, false, true));

// Check for character limits and valid types
validatePartnerFields(partnerInfo, errorMessages);
Expand All @@ -106,21 +106,56 @@ export async function validatePartnerInfo(partnerPath: string): Promise<string[]
* @param {string} filePath - The file path to the image.
* @returns {Promise<string[]>} - Returns a promise that resolves with an array of error messages if the image is invalid.
*/
export async function checkImageDimensions(filePath: string, maxWidth = maxThumbnailWidth, maxHeight = maxThumbnailHeight): Promise<string[]> {
/**
* Checks the dimensions of the partner's logo.
*
* @param {string} filePath - The file path to the image.
* @param {number} maxWidth - The maximum allowed width.
* @param {boolean} isWidthExact - Whether the width must match exactly.
* @param {number} maxHeight - The maximum allowed height.
* @param {boolean} isHeightExact - Whether the height must match exactly.
* @returns {Promise<string[]>} - Returns a promise that resolves with an array of error messages if the image is invalid.
*/
export async function checkImageDimensions(
filePath: string,
maxWidth = maxThumbnailWidth,
maxHeight = maxThumbnailHeight,
isWidthExact = false,
isHeightExact = false
): Promise<string[]> {
const errorMessages: string[] = [];

try {
const { width, height } = await sharp(filePath).metadata();

if (!width || !height) {
errorMessages.push(`image metadata could not be read for ${filePath}`);
} else if (width > maxWidth || height > maxHeight) {
errorMessages.push(`image dimensions exceed ${maxWidth}x${maxHeight} pixels`);
errorMessages.push(`Image metadata could not be read for ${filePath}`);
} else {
if (isWidthExact) {
if (width !== maxWidth) {
errorMessages.push(`Image width is ${width}px, but expected exactly ${maxWidth}px`);
}
} else {
if (width > maxWidth) {
errorMessages.push(`Image width is ${width}px, which exceeds the maximum allowed ${maxWidth}px`);
}
}

if (isHeightExact) {
if (height !== maxHeight) {
errorMessages.push(`Image height is ${height}px, but expected exactly ${maxHeight}px`);
}
} else {
if (height > maxHeight) {
errorMessages.push(`Image height is ${height}px, which exceeds the maximum allowed ${maxHeight}px`);
}
}
}
} catch (error) {
errorMessages.push('Error reading image metadata');
} finally {
return errorMessages;
errorMessages.push(`Error reading image metadata: ${(error as Error).message}`);
}

return errorMessages;
}

/**
Expand Down