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

feat(storyblok): update to the new service #497

Merged
merged 4 commits into from
Jun 21, 2022

Conversation

jorgemartins-uon
Copy link
Contributor

@jorgemartins-uon jorgemartins-uon commented Mar 23, 2022

Updates the storyblok provider to use their new Image Service API.

Linked to #474.

Copy link
Contributor

@Baroshem Baroshem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey,

I think you have covered the changes pretty well!

I am giving an approval but wait for Pio with the final decision :)

Copy link
Member

@atinux atinux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked the playground, looks good for me. Thanks @jorgemartins-uon

@jorgemartins-uon
Copy link
Contributor Author

jorgemartins-uon commented Apr 11, 2022

Thanks @Baroshem @atinux. @pi0 please let me know if there's anything left before we can have a final review and merge it? Thanks!

@sam-g-roberts
Copy link

sam-g-roberts commented Apr 20, 2022

Would be sweet if this could get merged @atinux @pi0

@venux92
Copy link

venux92 commented Apr 28, 2022

Any timeframe on when this PR will be merged?

@Saurou
Copy link

Saurou commented May 24, 2022

While we wait for this to be checked and merged, this could be a temporary solution:

new file ~/providers/custom.js

import { joinURL } from 'ufo'

export function getImage(src, { modifiers = {} }, { nuxtContext, $img }) {
  const {
    fit,
    smart,
    width = '0',
    height = '0',
    filters = {},
    format,
    quality
  } = modifiers

  const doResize = width !== '0' || height !== '0'

  if (format) {
    filters.format = format + ''
  }

  if (quality) {
    filters.quality = quality + ''
  }

  const _filters = Object.entries(filters || {})
    .map((e) => `${e[0]}(${e[1]})`)
    .join(':')

  const options = joinURL(
    fit ? `fit-${fit}` : '',
    doResize ? `${width}x${height}` : '',
    smart ? 'smart' : '',
    _filters ? 'filters:' + _filters : ''
  )

  return {
    url: joinURL(src, '/m/', options)
  }
}

then in nuxt.config.js

  image: {
      provider: 'customStoryblok',
      providers: {
        customProvider: {
          name: 'customStoryblok', // optional value to overrider provider name
          provider: '~/providers/custom', // Path to custom provider
          options: {
            // ... provider options
          }
        }
      }
    },

Please let me know if this is unnecessary or overkill, but it seems to be working on changing the url structure

@pi0 pi0 changed the title feat(provider): storyblok update to new api feat(storyblok): update to the new service Jun 20, 2022
@pi0 pi0 added the provider label Jun 20, 2022
Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for working on this <3

@pi0 pi0 merged commit 3edbd22 into nuxt:main Jun 21, 2022
procrates pushed a commit to procrates/nuxt-image that referenced this pull request Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants