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.

![xxx](xxx.jpg) can not display

See original GitHub issue

Using ![xxx](xxx.jpg)

can`t work well and pictures not display.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:7
  • Comments:5

github_iconTop GitHub Comments

5reactions
p11hcommented, May 17, 2017

This issue has been raised before (see #23 and #30).

If exporting to HTML your example works as expected, so this is only an issue in the viewer or if exporting to PDF.

While it is currently possible to workaround the issue by including the file:/// prefix, I would say that it is non-standard and non-intuitive, and would like the issue to be revisited if possible.

![xxx](file:///xxx.jpg)

Edit: Adding file:/// will work to display in the viewer, but export to HTML or PDF fails to render the image unless the full path is given:

![xxx](file:///xxx.jpg)
![xxx](file:///./xxx.jpg)
![xxx](file:///C:/test/xxx.jpg)

All three of these examples will render in the viewer, but only the final example (with full path) will render in the browser (at least while testing locally).

1reaction
patricktokeeffecommented, Oct 9, 2018

There is already code that attempts to prefix local image paths with “file:///” … https://github.com/nea/MarkdownViewerPlusPlus/blob/1a3dddc525913995bd65b6c7d6a6c11a1c2ca7f3/MarkdownViewerPlusPlus/Forms/MarkdownViewerRenderer.cs#L134

…but it has some issues:

  • naively searches for a colon (:) to identify presence of protocol
    • can fail if using local path (e.g. C:\Users\...) because C:\ contains a colon
  • uses Path.IsPathRooted [ref?] to determine if file:/// prefix is necessary
    • which will never return true for relative paths (almost certainly the type you are using)

This could be fixed up by using a regular expression to identify protocol prefixes and dumping the IsPathRooted check.


FWIW, the current situation has very strange behavior. With an image located in images/ subfolder:

  • These formats don’t work:
    • red X
      ![Data acquisition panel](C:\Users\pokeeffe\1D\Projects\PUYALLUPNET%20-%20Vik's%20logger\wsu-puyallup-net-logger\images\daq_panels.jpg)
    • red X
      ![Data acquisition panel](file:///C:\Users\pokeeffe\1D\Projects\PUYALLUPNET%20-%20Vik's%20logger\wsu-puyallup-net-logger\images\daq_panels.jpg)
    • gray stopwatch
      ![Data acquisition panel](C:/Users/pokeeffe/1D/Projects/PUYALLUPNET%20-%20Vik's%20logger/wsu-puyallup-net-logger/images/daq_panels.jpg)
    • gray stopwatch
      ![Data acquisition panel](C:/fake/path/images/daq_panels.jpg)
  • But these formats do:
    • ![Data acquisition panel](file:///C:/Users/pokeeffe/1D/Projects/PUYALLUPNET%20-%20Vik's%20logger/wsu-puyallup-net-logger/images/daq_panels.jpg)
    • ![Data acquisition panel](file://images/daq_panels.jpg)
    • ![Data acquisition panel](file:///images/daq_panels.jpg)
    • ![Data acquisition panel](file://///////////////images/daq_panels.jpg)
    • ![Data acquisition panel](C://///////////////images/daq_panels.jpg)
    • ![Data acquisition panel](C:/images/daq_panels.jpg) (not a valid absolute path!)
Read more comments on GitHub >

github_iconTop Results From Across the Web

Best 9 ways to fix 'Unable to Open JPEG file' error
Method 1: Update to the latest Windows Photo Viewer or Photos App ... If you?re unable to open JPEG photos in Windows, update...
Read more >
How to Fix Can't Open JPG Files in Windows 10? - YouTube
https://www.rescuedigitalmedia.com/ph... and download this best tool. Must watch this video guide to know how to fix Windows 10 Won't Open JPG ...
Read more >
Fix Cannot Open JPG Files on Windows 10
Sometimes Windows 10 Photo Viewer cannot open JPG files. This issue occurs due to file corruption or missing updates on PC. Try out...
Read more >
Jpegs being downloaded as pdf, then can't open the file
'Adobe Reader could not open xxx.jpg because it is either not a supported file type or because the file has been damaged etc.'....
Read more >
[Fix] Error “Windows Photo Viewer can't display this picture”
The Windows Photo Viewer error is caused due to color profile metadata ( ICC_Profile ) embedded into the JPG image(s). (You can reproduce...
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