congo icon indicating copy to clipboard operation
congo copied to clipboard

fix: add image fix

Open Jh123x opened this issue 1 year ago • 4 comments

  • [x] fix: fix img flip
  • [ ] test: test with image (No image to test)

Please let me know if anyone has an image to test

Closes #600

Jh123x avatar Nov 27 '23 15:11 Jh123x

Deploy Preview for hugo-congo ready!

Built without sensitive environment variables

Name Link
Latest commit 1b7361c50db31f2e601aad787254e386a7bf0e1e
Latest deploy log https://app.netlify.com/sites/hugo-congo/deploys/6565e82f4b4e5f00082aceb4
Deploy Preview https://deploy-preview-726--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.

netlify[bot] avatar Nov 27 '23 15:11 netlify[bot]

You can do something like this, to reduce repetition

    {{ $s := newScratch }}
    {{ $s.SetInMap "sizes" "330w" 330 }}
    {{ $s.SetInMap "sizes" "660w" 660 }}
    {{ if gt .Width 1024 }}
      {{ $s.SetInMap "sizes" "1024w" 1024 }}
    {{ end }}
    {{ if gt .Width 1320 }}
      {{ $s.SetInMap "sizes" "2x" 1320 }}
    {{ end }}
    {{ if le .Width 1320 }}
      {{ $s.SetInMap "sizes" (printf "%dw" .Width) .Width }}
    {{ end }}

...

          srcset="
            {{ range $key, $size := $s.Get "sizes" }}
              {{ ($img.Resize (printf "%dx webp %s" $size $rotation)).RelPermalink }} {{ $key }},
            {{ end }}"

          srcset="
            {{ range $key, $size := $s.Get "sizes" }}
              {{ ($img.Resize (printf "%dx %s" $size  $rotation)).RelPermalink }} {{ $key }},
            {{ end }}"

to reduce repetition

stereobooster avatar Nov 27 '23 22:11 stereobooster

You can do something like this, to reduce repetition

    {{ $s := newScratch }}
    {{ $s.SetInMap "sizes" "330w" 330 }}
    {{ $s.SetInMap "sizes" "660w" 660 }}
    {{ if gt .Width 1024 }}
      {{ $s.SetInMap "sizes" "1024w" 1024 }}
    {{ end }}
    {{ if gt .Width 1320 }}
      {{ $s.SetInMap "sizes" "2x" 1320 }}
    {{ end }}
    {{ if le .Width 1320 }}
      {{ $s.SetInMap "sizes" (printf "%dw" .Width) .Width }}
    {{ end }}

...

          srcset="
            {{ range $key, $size := $s.Get "sizes" }}
              {{ ($img.Resize (printf "%dx webp %s" $size $rotation)).RelPermalink }} {{ $key }},
            {{ end }}"

          srcset="
            {{ range $key, $size := $s.Get "sizes" }}
              {{ ($img.Resize (printf "%dx %s" $size  $rotation)).RelPermalink }} {{ $key }},
            {{ end }}"

to reduce repetition

Thanks for the suggestion. I am still new to hugo and have to read up on how this works first before implementing it ><

Jh123x avatar Dec 03 '23 08:12 Jh123x

I think an issue with this implementation is that it's only dealing with one orientation. Ideally this needs to handle all the possible values and rotate the image accordingly.

jpanther avatar Dec 23 '23 03:12 jpanther

This pull request has been automatically marked as stale because it has not had any recent activity. Please review the PR history and add a reply with any requested information. If no information has been requested, it may be that this contribution does not fit with the project objectives, or does not adhere to the contributing guidelines. If this is in error, please add a reply with further details. This PR will automatically close in 30 days if no further activity occurs.

github-actions[bot] avatar Apr 22 '24 02:04 github-actions[bot]