Skip to content
This repository has been archived by the owner on Mar 20, 2020. It is now read-only.

Image import is broken #7

Open
benwr opened this issue Dec 27, 2018 · 8 comments
Open

Image import is broken #7

benwr opened this issue Dec 27, 2018 · 8 comments

Comments

@benwr
Copy link
Owner

benwr commented Dec 27, 2018

Somehow we're now creating invalid apkgs when there are images. One problem is the relative paths change, but there's some deeper problem, because even when that's fixed we produce invalid archives.

@benwr
Copy link
Owner Author

benwr commented Dec 28, 2018

Fixed

@benwr benwr closed this as completed Dec 28, 2018
@xhw1
Copy link

xhw1 commented Jan 18, 2019

Hi, I just tested adding image but failed. Is this fixed in the current pip installed version? I'm using version 0.5.2

@benwr
Copy link
Owner Author

benwr commented Jan 18, 2019

Can you give more details about the failure? (yes, this should be fixed in the current pip version)

@LuccaHellriegel
Copy link

LuccaHellriegel commented Jun 23, 2019

I can confirm, that the image import does not seem to work.
I am using the following markdown with the picture in the same folder as the md-file:

alt text # shows the picture in my editor (vscode)

Expected Value of (f(x))

%

[\mathbb{E}[f(x)] = \sum_x p(x)f(x)]

%

math, probability


When looking at the HTML of the first page I see:

Expected Value of \(f(x)\)

Replacing the relative path does not seem to change anything.
Is there maybe a minimum working example with a picture?

@benwr
Copy link
Owner Author

benwr commented Jun 23, 2019

@LuccaHellriegel Weirdly, this seems to happen to me when I first import the package, but then if I restart Anki the image shows up properly. Can you confirm that this doesn't happen for you? It's a pretty annoying workaround, but I'm not sufficiently aware of Anki / genanki's internals to fix the problem.

@benwr
Copy link
Owner Author

benwr commented Jun 23, 2019

this might be related to kerrickstaley/genanki#17

@benwr benwr reopened this Jun 23, 2019
@LuccaHellriegel
Copy link

@benwr After restarting Anki, the image shows up, thanks. If I update the card, I also have to restart Anki. But thats not a big deal, but might deserve a mention somewhere in the readme. Anyway, thanks for your help.

@jay-pee
Copy link
Contributor

jay-pee commented Jul 6, 2019

When putting images in subfolders an error occurs:

Traceback (most recent call last):
  File "c:\Users\Philip\Documents\GitHub\ankdown\ankdown\ankdown.py", line 389, in main
    cards_to_apkg(card_iterator, pkg_arg)
  File "c:\Users\Philip\Documents\GitHub\ankdown\ankdown\ankdown.py", line 343, in cards_to_apkg
    copyfile(abspath, newpath) # This is inefficient but definitely works on all platforms.
  File "C:\Python36\lib\shutil.py", line 121, in copyfile
    with open(dst, 'wb') as fdst:
FileNotFoundError: [Errno 2] No such file or directory: 'assets/images/philly-magic-garden.jpg'

Maybe we have to create the folder before putting the image there with copyfile(abspath, newpath).
Or change the newpath variable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants