#Why do i get the "missing required width property" error when i'm loading static images?
17 messages · Page 1 of 1 (latest)
🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord
🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize
✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)
You need to either set the width & height of the image in the height and width props or use fill to let the image fill it. Keep in mind, when using fill props on the image it will be automatically positioned absolute, so wrap your image in a relative container
noted, thank you
no. only when you import the image statically would width and height not be necessary. and thats what i'd recommend (and that doesnt require putting in the public folder). don't put the image in the public folder if you don't need to
i specified the width, but it's still asking me to get the height
yes both width and height are required unless you import the image
import image from "./path/to/image.png"
i get a module not found error when i do this
how do you import it?
just put the image in the same folder and import it statically
it felt like a very makeshift solution so i wanted to understand where i'm going wrong
but yes, this does work
no it's not a makeshift solution, it is the officially recommended way to load local images https://nextjs.org/docs/app/building-your-application/optimizing/images#local-images
This question has been marked as answered! If you have any other questions, feel free to create another post
[Click here](#1247814643720781845 message)
in a typical nextjs app, you only need to use the public folder for a small number of things. images, fonts and such need not be stored there
i see, i was under the impression that the logos would also be stored there