Using different image:: url when generating HTML?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Using different image:: url when generating HTML?

russurquhart1
Hi,

I have several (100+) screen shots that i am using for an install procedure. I use Asciidoctor for writing, and have the images locally adjacent to the Asciidoctor source.

When i am finished, I generate HTML and then paste that into a ZenDesk Help Center topic that we use for our help center.

The issue is, the image:: url for the graphic, after it is loaded into the Help Center, is different than the url, on my local drive. This what i have:

    image::./images/media/Screen_Shot_2016-04-15_at_10.41.15_AM.png[image]
    image:/hc/en-us/article_attachments/203590706/Screen_Shot_2016-04-15_at_10.41.15_AM.png[image]

    image::./images/media/Screen_Shot_2016-04-15_at_10.53.55_AM.png[image]
    image:/hc/en-us/article_attachments/203590716/Screen_Shot_2016-04-15_at_10.53.55_AM.png[image]

Here are two images i have in my document. The top line is the location of the graphic wrt my Asciidoctor source, i.e. the file is in the images/media folder of my source directory.

The next line is the location of the same graphic, after it is loaded into html. It's location is on the server. Note that the directory that contains the graphic is unique for each graphic.

My question is, is there a way to have both of these lines in the document, but, when i generate the html, have it use the line with the server location?

I can manually comment out one line then the other, but was wondering if there was a more elegant way to do something like this?

Thanks,

Russ
Reply | Threaded
Open this post in threaded view
|

Re: Using different image:: url when generating HTML?

mojavelinux
Administrator
Russ,

You are describing exactly the scenario that the imagesdir attribute addresses. When using the image macros (block and inline), the recommend practice is to use a path that is relative to the root of your images. You can then set that root either globally or per document section using the imagesdir attribute.

For example:

image::Screen_Shot_2016-04-15_at_10.41.15_AM.png[]

In the local environment, you might set:

:imagesdir: ./images/media

or

ifndef::imagesdir[:imagesdir: ./images/media]

In your production environment, you'd override this value:

-a imagesdir=/hc/en-us/article_attachments/203590716

Try to keep as much knowledge about the publishing environment out of the source doc as you can.

Cheers,

-Dan

On Fri, Apr 22, 2016 at 10:14 AM, russurquhart1 [via Asciidoctor :: Discussion] <[hidden email]> wrote:
Hi,

I have several (100+) screen shots that i am using for an install procedure. I use Asciidoctor for writing, and have the images locally adjacent to the Asciidoctor source.

When i am finished, I generate HTML and then paste that into a ZenDesk Help Center topic that we use for our help center.

The issue is, the image:: url for the graphic, after it is loaded into the Help Center, is different than the url, on my local drive. This what i have:

    image::./images/media/Screen_Shot_2016-04-15_at_10.41.15_AM.png[image]
    image:/hc/en-us/article_attachments/203590706/Screen_Shot_2016-04-15_at_10.41.15_AM.png[image]

    image::./images/media/Screen_Shot_2016-04-15_at_10.53.55_AM.png[image]
    image:/hc/en-us/article_attachments/203590716/Screen_Shot_2016-04-15_at_10.53.55_AM.png[image]

Here are two images i have in my document. The top line is the location of the graphic wrt my Asciidoctor source, i.e. the file is in the images/media folder of my source directory.

The next line is the location of the same graphic, after it is loaded into html. It's location is on the server. Note that the directory that contains the graphic is unique for each graphic.

My question is, is there a way to have both of these lines in the document, but, when i generate the html, have it use the line with the server location?

I can manually comment out one line then the other, but was wondering if there was a more elegant way to do something like this?

Thanks,

Russ


If you reply to this email, your message will be added to the discussion below:
http://discuss.asciidoctor.org/Using-different-image-url-when-generating-HTML-tp4648.html
To start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML



--
Dan Allen | @mojavelinux | http://google.com/profiles/dan.j.allen
Reply | Threaded
Open this post in threaded view
|

Re: Using different image:: url when generating HTML?

russurquhart1
Hi Dan,

This is very helpful, the only thing is that the directory, for the html images, is different for each image. (This a function of how the Zen Desk Help System stores images for their Help Center.) So, for each image on the html side, the parent directory name is unique for each image.

I like you suggestion and will see if i can use that to some advantage!

Thanks,

Russ