Replies: 2 comments 4 replies
-
Hey @kwiat1990, I'm in the process of typing out a large explanation, but in the meantime try these fixes:
If you would like to use images from outside your Cloudinary assets, you might be able set your |
Beta Was this translation helpful? Give feedback.
-
Hey @kwiat1990, Sorry the docs were unclear. Hopefully I can explain a little better here and then update the docs soon. LoadersRemix-Image allows you to optimize your images in two different ways.
Option 1When your are using option 1, When following the Remix-Image tutorial, it instructs users to place the API route in In this case, you use TLDR:
Option 2When you are using option 2, you provide one of the
Yet as you’ve seen, I have yet to figure out the optimal URLs to provide for each service’s loader because I am using option 1. The provided loaders may have various bugs, so a PR would definitely be accepted if you are more knowledgeable about their particular API. Also, since you are using a ClientLoader, you don’t need to setup a TLDR:
StylesA goal of Remix-Image is to help your website load faster by optimizing images. One method Remix-Image uses to do this is setting image to lazy load by default. What this does is only make the HTTP request for an image once the browser has determined the However, a problem that occurs is that the browser doesn’t know how large an image is until the HTTP request has been made. This means that until the full image has been requested, the base So how do you ensure a lazy
If you know how big your image is going to be, you can always set the dimensions yourself and override the placeholder styles. You can do this by setting the /* my-styles.css */
.remix-image {
min-width: initial !important;
min-height: initial !important;
width: 500px;
height: 600px;
} Alternatively, if you don’t know the images size ahead of time but still want to remove the styles on load, you can mimic the import { Image } from “remix-image”;
const MyImageComponent = () => {
const [style, setStyle] = React.useState({});
return (
<Image
style={style}
onLoadingComplete={React.useCallback(() => setStyle({
minWidth: “initial”,
minHeight: “initial”
}))}
/>
);
} If you don’t want this to happen at all, either use the TLDR: |
Beta Was this translation helpful? Give feedback.
-
Hi, after update to
1.3.0
I'm having problems with loading images from Cloudinary. For starters I got rid of previous version ofsharp transformer
and replaced it with https://github.com/Josh-McFarlin/remix-image/tree/master/packages/remix-image-sharp. With that I could fix some errors which came up.To be honest I find docs about loaders a bit confusing. Using cloudinary louder all images have wrong size as they get these inline styles by default (720 px comes from my value set in
responsive
prop):Examples from docs are a bit confusing to me. On the one hand: https://remix-image.mcfarl.in/docs/client-loader#cloudinary-loader, which is followed by this example https://remix-image.mcfarl.in/docs/client-loader#usage:
At the end I don't know what values should be put for
loaderUrl
:/api/image
orhttps://res.cloudinary.com/<myCloud>
?URL for images from CMS looks following:
https://res.cloudinary.com/<myCloud>/image/upload/v1650996204/proste-opowiesci-develop/demo_4_fbb3dc7519.jpg
.When I follow the docs, I get 404 for my images, e.g.
https://res.cloudinary.com/<myCloud>/w_720,q_auto,f_auto/https://res.cloudinary.com/<myCloud>/image/upload/v1650996204/proste-opowiesci-develop/demo_4_fbb3dc7519.jpg
. What a bit confusing, if I omitresponsive
prop, then all images can be found and properly loaded. Withresponsive
URLs for images are broken and only placeholders will be loaded. On the other hand, when I use not those URLs from CMS, but Cloudinary ´public_id´ instead, then images are loaded but placeholder not.Additionally,
options
anddefaultOptions
seem to be ignored.Beta Was this translation helpful? Give feedback.
All reactions