BoostNote-Legacy icon indicating copy to clipboard operation
BoostNote-Legacy copied to clipboard

can not preview local pics in 0.11.13

Open zzxxhhzxh opened this issue 7 years ago • 16 comments

Current behavior

Can not show the pics(jpg,bmp,gif,svg) by markdown which is OK in previous version. But images by website is OK.

new bitmap image

![Google_2015_logo.svg](:storage\65473ce7-2769-4949-ad80-e348f9f261c6\e78c79d4.svg) Does not show image.

![](https://upload.wikimedia.org/wikipedia/commons/2/2f/Google_2015_logo.svg) Does show image.

Expected behavior

Can show local images.

Steps to reproduce

Drag local pics to notes.

Environment

  • Version : 0.11.13
  • OS Version and name : Win10 64bit professional

zzxxhhzxh avatar Jan 26 '19 14:01 zzxxhhzxh

I am experiencing the same issue. I added a comment here https://github.com/BoostIO/Boostnote/issues/1988#issuecomment-457833469 .

XarisA avatar Jan 26 '19 15:01 XarisA

A ~~quick~~ temporary fix for this is to change the last non-trailing slash ( \ ) to a trailing slash ( / ). This worked for me on Windows.

So in the case of ![Google_2015_logo.svg](:storage\65473ce7-2769-4949-ad80-e348f9f261c6\e78c79d4.svg) change it to ![Google_2015_logo.svg](:storage\65473ce7-2769-4949-ad80-e348f9f261c6/e78c79d4.svg)

When this issue is resolved, remember to modify this back to it's original state, or it might cause issues in loading the images properly.

Skovisen avatar Jan 26 '19 15:01 Skovisen

A quick fix for this is to change the last non-trailing slash ( \ ) to a trailing slash ( / ). This worked for me on Windows.

So in the case of ![Google_2015_logo.svg](:storage\65473ce7-2769-4949-ad80-e348f9f261c6\e78c79d4.svg) change it to ![Google_2015_logo.svg](:storage\65473ce7-2769-4949-ad80-e348f9f261c6/e78c79d4.svg)

That seem to work but it is possible to result in error after the issue is resolved. So maybe we should just wait.

XarisA avatar Jan 26 '19 15:01 XarisA

A quick fix for this is to change the last non-trailing slash ( \ ) to a trailing slash ( / ). This worked for me on Windows. So in the case of ![Google_2015_logo.svg](:storage\65473ce7-2769-4949-ad80-e348f9f261c6\e78c79d4.svg) change it to ![Google_2015_logo.svg](:storage\65473ce7-2769-4949-ad80-e348f9f261c6/e78c79d4.svg)

That seem to work but it is possible to result in error after the issue is resolved. So maybe we should just wait.

Yea, that's why I said it's a quick fix. I guess a better word is temporary, I'll edit my original comment.

Skovisen avatar Jan 26 '19 15:01 Skovisen

@daiyam @Rokt33r can you have a look at this? I've reverted the change breaking the attachemnts because i still don't understand what they do.. Furthermore i tried to let the tests test both linux and windows path separator

ehhc avatar Jan 26 '19 17:01 ehhc

@ehhc the function fixLocalURLS works on the HTML code so the \ should be generated as %5C. Is it the case? I don't have a working windows so I was unable to test it. I did assume the tests were correct (mdurl.encode(path.win32.sep)).

daiyam avatar Jan 26 '19 18:01 daiyam

The problem is the regex only matched the first '' not the following ones (separating the noteKey).. Nonetheless: i don't understand why the expression has to be that complicated instead of the simple form present before (and after my PR)... I completed the tests so that they test with a noteKey as well.

ehhc avatar Jan 26 '19 18:01 ehhc

@ehhc what is the generated html? The simpler regex assumes that an image path was terminated by an " which is no longer the case due to the added gallery block.

daiyam avatar Jan 26 '19 18:01 daiyam

@ehhc I found the error in the regex, pretty stupid :sob: And thanks you for the updated tests (they are failing correctly with the bad regex)

daiyam avatar Jan 26 '19 18:01 daiyam

We're trying to fix this now. After it fixed, I will release new version as soon as possible.

Rokt33r avatar Jan 28 '19 08:01 Rokt33r

I found the new problem, if I drag "Google_2015_logo.svg" to note, it will show like below

![Google_2015_logo.svg](:storage\6547f261c6\e78c79d4.svg)

But if I try to locate and open the file "e78c79d4.svg", I will find it is a png format image. So I have to change the extension and change the markdown sentense with "new splash" to

![Google_2015_logo.svg](:storage\6547261c6/e78c79d4.png)

Now it will work. This only happens in svg format. Png, jpg work well.

zzxxhhzxh avatar Jan 29 '19 06:01 zzxxhhzxh

@zzxxhhzxh i think that's another idependent problem.. Could you open a new issue for it?

ehhc avatar Jan 29 '19 07:01 ehhc

@zzxxhhzxh if you look at your jpg, you will see that in reality, it's an png. When pasting or dropping an image, Boostnote tries to fix its rotation (PR #2322), to do that, it converts the image as png... Ideally, there should be an option to disable this behaviour. You should open a new issue if you would like it to be fixed.

daiyam avatar Jan 29 '19 15:01 daiyam

Yes, you're right. The problem is that boostnote did not change the extension for file. So it fails to show.

On Tue, Jan 29, 2019, 09:01 Baptiste Augrain [email protected] wrote:

@zzxxhhzxh https://github.com/zzxxhhzxh if you look at your jpg, you will see that in reality, it's an png. When pasting or dropping an image, Boostnote tries to fix its rotation (PR #2322 https://github.com/BoostIO/Boostnote/pull/2322), to do that, it converts the image as png... Ideally, there should be an option to disable this behaviour.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/BoostIO/Boostnote/issues/2834#issuecomment-458571968, or mute the thread https://github.com/notifications/unsubscribe-auth/AonuFfb9O47rfd4bSktDKhLC1vhntxBBks5vIGJMgaJpZM4aUNOk .

-- ZHOU Xiaohuan Tongji University, Texas A&M University - Kingsville

zzxxhhzxh avatar Jan 29 '19 15:01 zzxxhhzxh

It has been fixed v0.11.15. But, sadly, you have to install it manually because the auto updater in v0.11.13 is broken too... Please download it from https://github.com/BoostIO/boost-releases/releases/tag/v0.11.15.

Rokt33r avatar Feb 08 '19 13:02 Rokt33r

The image now displays properly once updated from v0.11.13 to v0.11.15. However, since the update changes the "" to"/", the photo is now not properly rendered in the exported html file.

llfung avatar Feb 22 '19 17:02 llfung