From: Chris G. <cl...@is...> - 2017-01-21 19:19:23
|
This may be rather a silly question but at the moment I can't get the image directive to do anything useful for me. The documentation shows the syntax as:- .. image:: picture.png and says: "The URI for the image source file is specified in the directive argument." So, does that picture.png have to be a full URI or what? ... and where will the picture.png file be exactly? All I can do at the moment is get to see the text "picture.png". -- Chris Green |
From: log4yes <lo...@gm...> - 2017-01-22 01:59:21
|
You can use relative path from your source file to the image, or full uri(url). Make sure the path is correct. Some more info will help: 1. How do you generate the output? e.g. rst2html, online editor, github or blog using rst? 2. Is there some error/warning? 在 2017年01月22日 02:52, Chris Green 写道: > This may be rather a silly question but at the moment I can't get the > image directive to do anything useful for me. > > The documentation shows the syntax as:- > > .. image:: picture.png > > and says: "The URI for the image source file is specified in the > directive argument." > > So, does that picture.png have to be a full URI or what? ... and > where will the picture.png file be exactly? > > All I can do at the moment is get to see the text "picture.png". > |
From: Chris G. <cl...@is...> - 2017-01-22 11:47:13
|
On Sun, Jan 22, 2017 at 09:58:55AM +0800, log4yes wrote: > 在 2017年01月22日 02:52, Chris Green 写道: > > This may be rather a silly question but at the moment I can't get the > > image directive to do anything useful for me. > > > > The documentation shows the syntax as:- > > > > .. image:: picture.png > > > > and says: "The URI for the image source file is specified in the > > directive argument." > > > > So, does that picture.png have to be a full URI or what? ... and > > where will the picture.png file be exactly? > > > > All I can do at the moment is get to see the text "picture.png". > > > You can use relative path from your source file to the image, or full > uri(url). Make sure the path is correct. > So what appears above as "picture.png" should actually be:- http://server.mylan/pictures/picture.png (fictional address but that's the idea) ...or for a relative address:- ../../pictures/picture.png (or something like that, does it need anything more?) > Some more info will help: > 1. How do you generate the output? e.g. rst2html, online editor, github > or blog using rst? I'm using rst2html. > 2. Is there some error/warning? > Not that I can see. It's being run from PHP with stderr being redirected to a file, that file is zero length (but does exist) so I don't think there are any errors being reported. Thank you. -- Chris Green |
From: Guenter M. <mi...@us...> - 2017-01-22 21:46:51
|
On 2017-01-22, Chris Green wrote: > On Sun, Jan 22, 2017 at 09:58:55AM +0800, log4yes wrote: >> 在 2017年01月22日 02:52, Chris Green 写道: >> > This may be rather a silly question but at the moment I can't get the >> > image directive to do anything useful for me. >> > >> > The documentation shows the syntax as:- >> > >> > .. image:: picture.png >> > >> > and says: "The URI for the image source file is specified in the >> > directive argument." >> > >> > So, does that picture.png have to be a full URI or what? ... and >> > where will the picture.png file be exactly? There has to be a file at the location pointed to by the URI. If the URI is picture.png, this means a file picture.png in the same direcory as the generated document. > So what appears above as "picture.png" should actually be:- > http://server.mylan/pictures/picture.png This would work for any document that can access this URI (provided it points to a valid image file). > I'm using rst2html. >> 2. Is there some error/warning? > Not that I can see. It's being run from PHP with stderr being > redirected to a file, that file is zero length (but does exist) so I > don't think there are any errors being reported. When generating HTML and not giving options that require a look at the image (scaling, ...), the URI is not checked during the process. Günter |
From: Chris G. <cl...@is...> - 2017-01-22 22:08:29
|
On Sun, Jan 22, 2017 at 09:46:13PM +0000, Guenter Milde wrote: > On 2017-01-22, Chris Green wrote: > > On Sun, Jan 22, 2017 at 09:58:55AM +0800, log4yes wrote: > >> 在 2017年01月22日 02:52, Chris Green 写道: > >> > This may be rather a silly question but at the moment I can't get the > >> > image directive to do anything useful for me. > >> > > >> > The documentation shows the syntax as:- > >> > > >> > .. image:: picture.png > >> > > >> > and says: "The URI for the image source file is specified in the > >> > directive argument." > >> > > >> > So, does that picture.png have to be a full URI or what? ... and > >> > where will the picture.png file be exactly? > > There has to be a file at the location pointed to by the URI. > If the URI is picture.png, this means a file picture.png in the same > direcory as the generated document. > > > So what appears above as "picture.png" should actually be:- > > > http://server.mylan/pictures/picture.png > > This would work for any document that can access this URI (provided it > points to a valid image file). > > > I'm using rst2html. > > >> 2. Is there some error/warning? > > > Not that I can see. It's being run from PHP with stderr being > > redirected to a file, that file is zero length (but does exist) so I > > don't think there are any errors being reported. > > When generating HTML and not giving options that require a look at the image > (scaling, ...), the URI is not checked during the process. > > Günter > OK, thanks, I'll try a bit more. -- Chris Green |
From: Chris G. <cl...@is...> - 2017-01-23 15:58:37
|
> > > OK, thanks, I'll try a bit more. > OK, I've been trying some more! :-) I can get the following to work:- .. image:: http://esprimo/mandyFlat/DSCF6584.JPG I can't get anything like this to work at all:- .. image:: DSCF6584.JPG (yes, I have copied the JPG file to the directory where the rst text is) The code it generates is:- <img alt="DSCF6584.JPG" src="DSCF6584.JPG" /> which is sort of alright except that, presumably, the web server (apache2) can't actually find the image with just that as the address. I guess the problem is down to the fact that the page is generated dynamically. -- Chris Green |
From: Roberto A. <ra...@kd...> - 2017-01-23 16:03:18
|
If you are going to use relative URLs, they need to be relative to where the HTML page resides, not to where the rst text is. So, if your page ends at http://foo.bar/boo/this.html with a relative URL to the image of "DSCF6584.JPG" then the image better be available at http://foo/bar/boo/DSCF6584.JPG or it will not work. On Mon, Jan 23, 2017 at 12:59 PM Chris Green <cl...@is...> wrote: > > > > > OK, thanks, I'll try a bit more. > > > OK, I've been trying some more! :-) > > I can get the following to work:- > > .. image:: http://esprimo/mandyFlat/DSCF6584.JPG > > > I can't get anything like this to work at all:- > > .. image:: DSCF6584.JPG > > (yes, I have copied the JPG file to the directory where the rst text is) > > > The code it generates is:- > > <img alt="DSCF6584.JPG" src="DSCF6584.JPG" /> > > which is sort of alright except that, presumably, the web server > (apache2) can't actually find the image with just that as the address. > I guess the problem is down to the fact that the page is generated > dynamically. > > -- > Chris Green > > > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, SlashDot.org! http://sdm.link/slashdot > _______________________________________________ > Docutils-users mailing list > Doc...@li... > https://lists.sourceforge.net/lists/listinfo/docutils-users > > Please use "Reply All" to reply to the list. > |
From: Chris G. <cl...@is...> - 2017-01-23 17:50:51
|
On Mon, Jan 23, 2017 at 04:02:59PM +0000, Roberto Alsina wrote: > If you are going to use relative URLs, they need to be relative to > where the HTML page resides, not to where the rst text is. > So, if your page ends at [1]http://foo.bar/boo/this.html with a > relative URL to the image of "DSCF6584.JPG" then the image better be > available at [2]http://foo/bar/boo/DSCF6584.JPG or it will not work. > Unfortunately my HTML doesn't reside anywhere, it's generated by rst2html and eaten by a PHP script. That's what I meant by it being generated 'dynamically'. I think basically there's no practical way to use relative URIs in my situation, they'll have to be absolute. -- Chris Green |
From: Guenter M. <mi...@us...> - 2017-01-23 21:05:22
|
On 2017-01-23, Chris Green wrote: > On Mon, Jan 23, 2017 at 04:02:59PM +0000, Roberto Alsina wrote: >> If you are going to use relative URLs, they need to be relative to >> where the HTML page resides, not to where the rst text is. >> So, if your page ends at [1]http://foo.bar/boo/this.html with a >> relative URL to the image of "DSCF6584.JPG" then the image better be >> available at [2]http://foo/bar/boo/DSCF6584.JPG or it will not work. > Unfortunately my HTML doesn't reside anywhere, it's generated by > rst2html and eaten by a PHP script. That's what I meant by it being > generated 'dynamically'. For the viewing browser, it should make no difference whether it is static or dynamic: if you can view the generated HTML document under http://example.org/this/is/a/dynamic/path/mydoc.html or http://example.org/this/is/a/dynamic/path/mydoc.php, a relative URL should be relative to http://example.org/this/is/a/dynamic/path/ but: > I think basically there's no practical way to use relative URIs in my > situation, they'll have to be absolute. Indeed, absolute URIs seem to be the most practical solution for your problem. Günter |