Skip to content

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

Merged
pi0 merged 4 commits into
nuxt:mainfrom
jorgemartins-uon:feat/provider/storyblok
Jun 21, 2022
Merged

feat(storyblok): update to the new service#497
pi0 merged 4 commits into
nuxt:mainfrom
jorgemartins-uon:feat/provider/storyblok

Conversation

@jorgemartins-uon

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

Copy link
Copy Markdown
Contributor

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

Linked to #474.

@Baroshem Baroshem left a comment

Copy link
Copy Markdown
Collaborator

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 :)

@atinux atinux left a comment

Copy link
Copy Markdown
Member

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

jorgemartins-uon commented Apr 11, 2022

Copy link
Copy Markdown
Contributor Author

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

sam-g-roberts commented Apr 20, 2022

Copy link
Copy Markdown

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

@venux92

venux92 commented Apr 28, 2022

Copy link
Copy Markdown

Any timeframe on when this PR will be merged?

@Saurou

Saurou commented May 24, 2022

Copy link
Copy Markdown

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

@pi0 pi0 left a comment

Copy link
Copy Markdown
Member

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
@github-actions github-actions Bot mentioned this pull request Jul 30, 2026
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