bejamas / gatsby-storyblok-image Goto Github PK
View Code? Open in Web Editor NEWUse gatsby-image with images hosted on Storyblok CDN.
License: MIT License
Use gatsby-image with images hosted on Storyblok CDN.
License: MIT License
I am trying to use this for a fluid image however when I'm passing the image object it is returning null
import { getFixedGatsbyImage } from "gatsby-storyblok-image"
const TypeImages: FC<typeImagesProps> = ({ type }) => {
// Extract the active type from context
const { activeType, activeFragranceIndex } = useContext(ProductContext)
if (!activeType || !activeType) return null
const { type: typeName, image: typeImage } = type
const image = getFixedGatsbyImage(typeImage, { width: 900 })
All assets not coming directly from Storyblok are automatically rejected. We need to find a way to support also images from Cloudinary as it is a secondary asset manager possible to use in Storyblok.
if there is an asset with uppercase file extension eg. //a.storyblok.../../image.PNG
- it will be rejected in getBasicImageProps.js
I found out .svg images are not handled properly. Most of the times the url of svg's is //a.storyblok.com/f/123321/x/12345678/xzy.svg
3rd part of the URL stands for size (?) and just "x" doesn't match with the current regex what breaks the image formatting
Please add support for the new gatsby image plugin: https://github.com/gatsbyjs/gatsby/tree/master/packages/gatsby-plugin-image#readme
Hi,
I came across this package recently, really glad I found it. However, I can't get the blur effect (on load) to work. Right now, the image is initially not showing at all. Once it's loaded, it shows. But no blur-up effect. I am using storybloks asset manager and I pretty much just copied your example:
import SbEditable from 'storyblok-react'
import Img from 'gatsby-image'
import { getFixedGatsbyImage } from 'gatsby-storyblok-image'
import { getFluidGatsbyImage } from 'gatsby-storyblok-image'
const FluidImage2 = ({ imgUrl }) => {
const fluidProps = getFluidGatsbyImage(imgUrl, {
maxWidth: 900,
quality: 100,
})
return (
<SbEditable content={imgUrl}>
<Img
fluid={fluidProps}
style={{ width: '100%', height: '100%' }}
/>
</SbEditable>
)
}
Am I missing anything? Is there a setting or prop I am not aware of?
Thanks a lot!
Hi I am having a this error
warning: Failed prop type: The prop fluid
or fixed
is marked as required in Image
, but their values are both undefined
.
import React from 'react';
import SbEditable from "storyblok-react"
import Img from "gatsby-image";
import { getFluidGatsbyImage } from 'gatsby-storyblok-image'
import { render } from "storyblok-rich-text-react-renderer"
const Program = ({ blok }) => {
const img = blok.image
const fluidProps = getFluidGatsbyImage(img, {
maxHeight: 400
})
return (
<SbEditable content={blok} key={blok._uid}>
<Layout pageTitle="title">
<PageHeader title={blok.pagetitle} />
<section>
<div>
<div>
<div>
<div>
<div>
<Img fluid={fluidProps} />
</div>
<div className="blog-one__content">
<h1>{blok.title}</h1>
{render(blok.description)}
</div>
</div>
</div>
</div>
</div>
</section>
</Layout>
</SbEditable>
);
}
export default Program;
Hi there,
I'm experiencing issues with the fixed property not being recognized. However, the component is rendering just fine.
Console error:
Warning: Failed prop type: Invalid prop
fixedsupplied to
Image. in Image (at fixed_image.js:14)
Component:
import React from 'react'
import SbEditable from 'storyblok-react'
import Img from 'gatsby-image'
import { getFixedGatsbyImage } from 'gatsby-storyblok-image'
const FixedImage = ({ blok }) => {
if (blok.image !== 'undefined' && blok.image !== '') {
const fixedProps = getFixedGatsbyImage(blok.image, {
width: 900
});
return (
<SbEditable content={blok}>
<Img fixed={fixedProps} />
</SbEditable>
)
}
return (
<SbEditable content={blok}>
<p>Please upload image</p>
</SbEditable>
)
}
export default FixedImage
There seems to be issues with the filter format for generating a storyblok image path. There should be no colon between the filter name and the value.
https://github.com/bejamas/gatsby-storyblok-image/blob/master/src/utils/buildImageUrl.js#L19
filters:quality**:**(80) should be filters:quality(80)
Any news on this issue? I have also this warning
Warning: Failed prop type: The prop fluid
or fixed
is marked as required in Image
, but their values are both undefined
.
Originally posted by @Qurus in #9 (comment)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.