Comments (5)
Does Image CDN will only works on Gatsby Cloud? Not like normal hosting platforms.
from gatsby.
Does Image CDN will only works on Gatsby Cloud? Not like normal hosting platforms.
It does work now on Netlify properly using Netlify Image CDN (without extra hacks) and you can "implement" your own as well - https://www.gatsbyjs.com/docs/reference/release-notes/v5.13/#custom-image-and-file-cdn-url-generators
Please note that above thing is just to generate url for images and you (or your image cdn backend) are responsible for handling those requests. The arguments for transformations are pretty much subset of what Imgix handles so in my tests I did try Imgix backend:
const ImgixClient = require("@imgix/js-core");
const client = new ImgixClient({
domain: "none-9083.imgix.net",
secureURLToken: "<redacted>",
});
/**
* @type {import("gatsby").ImageCdnUrlGeneratorFn}
*/
exports.default = (source, args, pathPrefix) => {
const url = client.buildURL(source.url, args);
console.log(`image-cdn`, {
source,
args,
url,
});
return url;
};
Just I did have imgix account from some time ago with "Web proxy" source setup (it allows any remote urls) - now that source is enterprise-only in imgix, but there is "Web folder" where you specify "base url" (which would include a domain) and would need to adjust url builder to match expected format.
Alternatively any other image cdn provider could be used as long as it supports at least transformations that you are using in your site.
I did try creating a function/lambda to handle those, but in a lot of cases it was quite problematic, with requests often erroring out due to timeouts etc, so trying to support it this way (where users/platforms don't have to configure image cdns themselves) was a problem magnet and issues caused by this were impacting visitors of the site (while slow build times are annoying, but don't impact site once it's deployed - so out of the 2 it's better to have slow builds than problems on deployed sites)
from gatsby.
If you don't want to use ready-made image cdn backends, maybe you could look into https://github.com/unjs/ipx (tho this one out of the box doesn't support remote images - https://github.com/netlify/netlify-ipx is netlify wrapper for it that does support external urls), but this is much more involved and not something you could just "turn on"
In my tests with it I never fully finished proper function with all the functionality - just enough to get something going, but seeing issues I dropped the idea of finishing it up and adding it as part of core gatsby functionality due to issues with that approach (as mentioned in previous comment)
from gatsby.
Hiya!
This issue has gone quiet. Spooky quiet. ๐ป
We get a lot of issues, so we currently close issues after 60 days of inactivity. Itโs been at least 20 days since the last update here.
If we missed this issue or if you want to keep it open, please reply here.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!
Thanks for being a part of the Gatsby community! ๐ช๐
from gatsby.
Hey again!
Itโs been 60 days since anything happened on this issue, so our friendly neighborhood robot (thatโs me!) is going to close it.
Please keep in mind that Iโm only a robot, so if Iโve closed this issue in error, Iโm HUMAN_EMOTION_SORRY
. Please feel free to comment on this issue or create a new one if you need anything else.
As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing!
Thanks again for being part of the Gatsby community! ๐ช๐
from gatsby.
Related Issues (20)
- gatsby-plugin-page-creator: slugify.preserveCharacters does not have any effect
- Excessive Build Times with gatsby-source-shopify During 'source shopify variants' Stage
- gatsby-source-wordpress: update node unable to fetch media item due to missing domain
- Gatsby MDXRenderer: Error Element type is invalid: expected a string HOT 2
- gatsby build produces different output between ubuntu 22.04 and windows-2022 (on github actions)
- Gatsby transform sharp throws intermittent errors HOT 3
- MDX content only rendered after refresh HOT 2
- gatsby-source-mongodb not fetching Atlas data HOT 5
- ModuleParseError: Module parse failed: Unexpected character '@' (2:0) after upgrading gatsby to v5 HOT 1
- `allMarkdownRemark` graphql query in `createPages` intermittently hangs when `excerpt` or `timeToRead` fields are included
- function build error: Error: Module build failed: UnhandledSchemeError HOT 2
- Gatsby 5 is dead? HOT 1
- webpack and other js resources not found when using a subfolder of a static s3 website to serve public files
- Gatsby static site generation not fully prerendering HTML with loadable imports
- Gatsby minimal TS starter generates code with deprecated React import
- gatsby-transformer-remark doesn't accept "engines" plugin option for graymatter
- matchPath seems to be broken since adapters
- The first Headless CMS starter link is broken
- Gatsby + Directus = Build not working HOT 1
- Validation error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gatsby.