Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🚸 🩹 SVG support for author's image #687

Closed
wants to merge 1 commit into from

Conversation

wolfspyre
Copy link
Contributor

sidestep image resizing operations when using a vector image for the author's image.. Pretty straight forward.

I didn't see anyplace else that these images are in use.
Did I miss anything?

single-brk
single-en
Homepage-Profile-en
homepage-profile-BRK

@netlify
Copy link

netlify bot commented Oct 27, 2023

Deploy Preview for hugo-congo ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 984bb01
🔍 Latest deploy log https://app.netlify.com/sites/hugo-congo/deploys/653b1439162460000845261f
😎 Deploy Preview https://deploy-preview-687--hugo-congo.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@jpanther jpanther added the enhancement New feature or request label Oct 31, 2023
@jpanther
Copy link
Owner

I think working towards SVG support all round is good, however this PR has the opposite issue to the other one where now we're removing the size restriction but still imposing one on normal image assets. I'm a big believer in being strict about keeping things consistent as it prevents confusion for users.

@wolfspyre
Copy link
Contributor Author

wolfspyre commented Oct 31, 2023

an SVG will (USUALLY) fit itself into the parent container.

The problem we're working with here is the resizing methods hugo provides for images don't support vector images, as you don't really RESIZE a vector asset in the same way one would manipulate a raster image resource,

in this scenario, you're asking hugo to transform the initial image asset to 2x the <img> resource dimension properties,
and then declaring the image resource with set w/h.

for reference, I put the image I used in that page here:
https://dog.wolfspyre.io/wplimgs/Atticus-in-square-frame.svg

it's viewbox dimensions in the file itself is 430x430, but it sizes itself according to the html <img> tag's dimensions
which ARE still present:

author.html:

        <img
          class="!mb-0 !mt-0 me-4 h-24 w-24 rounded-full"
          width="96"
          height="96"
          alt="{{ $.Site.Author.name | default "Author" }}"
          src="{{ $authorImage.RelPermalink }}"
          {{ if $.Site.Params.enableImageLazyLoading | default true }}
            loading="lazy"
          {{ end }}
        />

profile.html:

        <img
          class="mb-2 h-36 w-36 rounded-full"
          width="144"
          height="144"
          alt="{{ $.Site.Author.name | default "Author" }}"
          src="{{ $authorImage.RelPermalink }}"
        />

The change only sidesteps the .Fill image method operation, which is a raster-resizing operation that's not relevant to vectors...

this make sense?

@wolfspyre
Copy link
Contributor Author

closed in favor of #741

@wolfspyre wolfspyre closed this Dec 5, 2023
@wolfspyre wolfspyre deleted the svg-author branch April 24, 2024 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants