How to use Image correctly
See original GitHub issueIf reference the image in react
import testPng from './static/text.png'
<Image src={testPng}/>
console:
QPixmap::scaled: Pixmap is a null pixmap
Okay it doesn’t work
If I use resolve to reference the image
const imageUrl = `${path.resolve(__dirname, `./static/text.png`)}`;
<Image src={imageUrl}/>
When I was debugging it was successful
But when I pack:
webpack -p && nodegui-packer --pack ./dist
the image has not been webpacked and is not packed into dist
Image doesn’t show up after I open the app
Issue Analytics
- State:
- Created 4 years ago
- Comments:24 (1 by maintainers)
Top Results From Across the Web
The Ultimate Guide For Using Images On Your Website
Choosing the right images for your website is important. This guide shows you how to best use images for your website.
Read more >How to Use Images Effectively in Websites - WebFX
Use Images with Purpose · Use Photos of Real People · Point Out the Obvious · Use Images to Illustrate Concepts · Optimize...
Read more >How to Resize an Image Correctly | The TechSmith Blog
Use photo editing software to resize your image; Avoid stretching or distorting your images by locking the aspect ratio before making adjustments. Start...
Read more >The Essential Guide to Using Images Legally Online
Image use can be tricky. Learn EXACTLY how to legally use images online, how to interpret licenses, and find copyright-free images.
Read more >Formatting your images for display on the web
Your image's color mode or color profile might not be formatted correctly. Review our image requirements to confirm you're using the correct ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Alright! I manage to fix this issue in MacOS @Grewer and @Solant This will be fixed in the next packer release.
But if you would like to fix it in your current setup.
After
npx nodegui-packer --init MyApp
Change the contents of
deploy/darwin/MyApp.app/Contents/MacOs/qode.json
toAdd a new file at
deploy/darwin/MyApp.app/Contents/Resources/index.js
with the contentsNow do
npx nodegui-packer --pack ./dist
And the assets paths should be resolved correctly!
Hi @Solant and @Grewer This is because the current working directory for macos is something different. I am currently working on Qode v2.0 which might need a bit of changes in the packer as well. So I ll fix it up in packer alongside it. ETA: this weekend for now. But lets see if I can fix it before that. Thanks for looking into this @Solant