hypercerts-org / hypercerts

Hypercerts are a tool to build scalable retrospective reward systems for impact.
https://hypercerts.org/
Other
91 stars 28 forks source link

bug: logo isn't displayed correctly #264

Closed holkexyz closed 1 year ago

holkexyz commented 1 year ago

I used this logo: https://site-assets.plasmic.app/e1dddbd0e6a7104aee374d7b1b47a04a.svg

It looks fine in the create app:

Image

But it doesn't show correctly later: Image

ccerv1 commented 1 year ago

Check dimensions of images to confirm it's not a library issue (or dimensions issue)

ryscheng commented 1 year ago

@holkeb did you try again with a different image type (not SVG) or different image dimensions?

holkexyz commented 1 year ago

@ryscheng SVGs: Yes, I created 3 more with SVG's and I got the bug consistently --> agree to forbid SVGs for now

PNGs and JPGs: The preview also looks different than the result. The preview is centered and scaled, while result is stretched.

Preview with centered and scaled logo

Pasted Graphic 1

Result with stretched logo

Pasted Graphic 2
ccerv1 commented 1 year ago

OK, I think I have figured this out.

First, I requested all the Gitcoin banner images and took their dimensions. The dimensions we want for a banner are 320 x 214 and for an icon 40 x 40.

Then, I started running some tests comparing create previews and actual hypercerts. All of the actual hypercerts were compressed, even ones like Jolly Roger that need to be stretched to fill the banner size.

You can see these below:

Project Dimensions Preview Actual Issues
Jolly Roger 249 x 83 image image width is compressed
Natives in Tech 1500 x 500 image image width compressed + doesn't appear to span banner

Next, I looked through the actual dimensions and saw that all were supposed to have a 3:1 aspect ratio. This is when I realized that Natives in Tech had its width extended with transparent pixels (presumably by the Gitcoin app) to conform to their banner spec.

To fix this, we will need to process the images as follows:

Banners

  1. Identify images that have transparent padding
  2. For those with padding:
    • Crop out the transparent padding
    • Shrink/stretch to width of 320 pixels
    • Crop top and bottom to height of 214 pixels
  3. For the rest:
    • Shrink/stretch to height of 214 pixels
    • Crop sides to width of 320 pixels

Icons

  1. Find the smaller dimension
  2. Shrink/stretch on that dimension to 40 pixels
  3. Crop on the other dimension to 40 pixels
ccerv1 commented 1 year ago

Here is Natives in Tech create page with images cropped per the above methodology.

Preview

image

Actual

image
ccerv1 commented 1 year ago

Update: I've created an image processing script and (temporarily) put new banner images on IPFS.

Will create separate issue for hosting assets on our CDN and updating the .gitignore