magicbookproject / magicbook

The magic book project returns!
MIT License
1.07k stars 59 forks source link

fixes #29; img.src attribute not correctly resolved on Windows #30

Closed AntonioGHub closed 4 years ago

AntonioGHub commented 5 years ago

solves image files are not found on Windows · Issue #29

shiffman commented 5 years ago

Thank you for looking at this @AntonioGHub! @joeyklee maybe we should test to make sure this doesn't break mac os and then it's good to merge as far as I'm concerned!

AntonioGHub commented 5 years ago

Well, I guess your public dan...@s.....n.net mail address is not checked very frequently....

On 19/09/2019 14:34, Antonio wrote

to:d...@s.....n.net You are welcome Daniel :)

Just as an aside (outside github and the build of the book), I couldn't get around to read the book yet (book, which is very promising), but I skimmed through the diagrams and they are beautifully drawn in a sort of freehand style. For long I have been looking for a tool to draw sketched (yet neat) lines but I couldn't find one. Is the one you are using publicly available somewhere?

Thanks! Antonio

joeyklee commented 5 years ago

@shiffman - I can confirm that these changes do not break the MacOS magicbook build. The tests pass as well. I don't have write access to the magicbook project, so you'll have to do this one!

Just a few notes:

joeyklee commented 5 years ago

@AntonioGHub - Thanks again for this PR! Regarding your question above - @zee-moz did the illustrations for the Nature of Code. She's a wiz in illustration so I can imagine it was mostly with pencil/ink and then put into Adobe Illustrator (or similar vector drawing or photo editing program). I guess nothing can replace training your hand old school style ;)

Hope this helps!

zee-moz commented 4 years ago

@AntonioGHub glad you like the illustrations. I do a lot freehand, but for at least some of this project I believe I made some custom brushes and worked in Illustrator on wacom tablet. More recently I've been using Procreate with Apple Pencil on my iPad Pro (though you don't need one to do this). It's super great, and had it been around when I was working on the NOC illos it would have saved me tons of time! I highly recommend it.

AntonioGHub commented 4 years ago

@zee-moz really freehand? I would have sworn that a figure like this was written with some sort of CAD which could render the graphic in a freehand like fashion. This doesn't solve my problem (finding a quick and easy sketching tool), but congratulation for your style! And thanks for the hints!

@joeyklee When I decided to use path.normalize() I remember I intentionally discarded path.resolve() but I cannot remember why exactly. Surely an important difference is that resolve may not work straight away. It determines the full (absolute) path to the file, which is different from the relative path maintained by normalize, as you already stressed out; in the case of NOC2 the imageMap is filled with relative paths so node.js would assume that the initial segment of the path is the current directory, to which the relative path is appended (something like $current_directory/chapterX/imageY.jpg). But "current directories" can be the source of tricky bugs and I would avoid them tout-court.