question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not clear how to include images in my application

See original GitHub issue

This is probably an RTM moment for me with Electron in general, but it’s not obvious how to set this up so that images can be included in the stylesheets (via background-image) or via img tags in the react markup: trying to link to an image throws a missing loader error because the url is parsed as a require. How could I go about getting images to show up in a project based on this boilerplate? Thanks,

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:44 (11 by maintainers)

github_iconTop GitHub Comments

42reactions
kadamwhitecommented, Jun 20, 2016

@amilajack Apologies, I shouldn’t have brought up the loaders at all because my question was not CSS-specific; I can figure out how to work around the loaders on my own. My question is, where I would put an image asset within the boilerplate so that it could be loaded through a regular image tag. I’m confused about how Electron actually locates static assets, should I want to load a resource as a normal img tag src as opposed to through part of the webpack bundle.

For a more concrete question, where would I put an image file and how would I formulate my src attribute such that adding an img tag to the Counter component would display that image?

Thank you for any assistance you might be able to offer!

27reactions
johnryancommented, Dec 29, 2016

@amilajack figured out the issue, the css is using a relative path to the file while the img tag is looking in the top level img folder.

if anyone else has this problem i had to do:

import my_image from './img/my_image.png'; //relative path to image
<img src={my_image} />
Read more comments on GitHub >

github_iconTop Results From Across the Web

Why am not getting clear images while working in Android ...
I am creating my app in android studio and I am using an image, if no past order present. I have imported images...
Read more >
3 Easy Ways to Make Blurry Image Clear and Sharp
To make a blurry image sharp and clear, upload it to letsenhance.io, and click Start processing. That's the simplest answer.
Read more >
Formatting your images for display on the web
Images added to galleries display best if all images have a similar shape. For example, use all landscape images (wider than they are...
Read more >
Preventing Blurry Pictures: The Keys to Clear Images
Nothing is more frustrating than blurry pictures. While you can try tinkering in a photo editing program, the best strategy is to start...
Read more >
12 Best Apps To Make Pictures Clear in 2022 (Fix Blurry Photos)
After you open a photo in the app, you can select a “look” (aka filter) to apply to your image. Or you can...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found