[IPython-User] problem image in markdown

Matthias BUSSONNIER bussonniermatthias@gmail....
Thu Apr 4 05:08:56 CDT 2013


Hi, 

Le 4 avr. 2013 à 11:40, christian jeanguillaume a écrit :

> Hie,
> and many thanks to Aaron and Matthias for helping me.
> I am ashame chi is better than khi and work fine.

No problem, it is not obvious

> ...
> ![Texte](http://www.e-architect.co.uk/images/jpgs/canada/vancouver_cc_west_l160210_3.jpg 
> "texte pour le titre, facultatif")
> ...
> file:///home/jeanguillaume/Python/cacaoPython/haricot_commun_frais_nu-1.jpg
> ...
> ![Texte](file://haricot_commun_frais_nu-1.jpg 
> "texte pour le titre, facultatif")

I guess this is a comprehension problem, it is difficult to explain by text, I'll just try again. 
let's assume the following : Browser, server and kernel are on 3 different machine. 
It can be the same machine, but it's easier to explain for vocabulary.

the Browser is opened on your laptop point to  http://mycompter.mydomain.org/ipython/
the Server is you Desktop computer. (where you ran $ipython notebook --profile=ec2 from ~/ipython directory)
the kernel is on ec2. 


files://whatever/file.png as a url represent a file on your laptop. 
For security reason the browser does not allow to access files:// url from html.
So files:// will never work unless directly entered in address field. here files:// is the used protocol. 
Just forget using it. 

Image(filename='/whaterver/file.png) 
Will read the image from ec2 hard drive. returning it on the wire. because this is where the **kernel** lives.

[!img](files/subfolder/whaterver.png) *relative*(no leading slash) *url* will resolve to the following *full* *url*:
http://mycompter.mydomain.org/ipython/files/subfolder/whaterver.png
Which correspond to the **relative** **path** subfolder/whaterver.png with respect to where the server
has been launched ie the **full** **path**  ~/ipython/subfolder/whatever.png on your desktop computer. 


So back to everything on one computer
If you have the following directory structure :
myproject/
	test.ipynb
	haricot_commun_frais_nu-1.jpg

and you cd into my project and run ipython notebook. you will have to use the following syntax in test1.ipynb :
	
	![img](files/haricot_commun_frais_nu-1.jpg)

where here files is **not** the files:// protocol, it is a relative url.

if you could look at all the subfiles accessible from relative files/* url, you would see the content of /myproject 
the fact that it resolves through the kernel is a special case, same as the fact that it is accessible through files:// protocol.

Hope this make more sens.
-- 
Matthias


  









More information about the IPython-User mailing list