Using your example, Sreeram, but adapting it to my own set of images (which are not cows or spiders!) I can now see clearly how to make use of all the essential information that had initially been provided by Wolfgang, and also the important hint, which I had clumsily and unsuccessfully been trying anyway before he offered it, from Aditya, about passing key value parameters along the lines of Wolfgang's 'name ='. It simply did not occur to me to do this using 'factor= '. But there was much more about the example I would not have worked out by myself as well! Thank you (all) for your patience. Julian On 10/3/22 17:51, śrīrāma wrote:
On Thursday, March 10, 2022 3:32 AM jbf via ntg-context wrote:
Am endeavouring to explore Wolfgang's very 'elegant' solution to this facing page challenge. The exploration has included a look at base/mkxl/page-inj.mklx (thanks Sreeram for reminding me of this) where I see immediately that the approach is experimental and where it says also that 'probably more alternatives will be added'. I wonder if that last phrase also includes the ability to manipulate the image(s) either generally or in individual cases?
The following example is based on Wolfgang's solution using injections: I have modified the setup slightly to hook into \externalfigure's {width, height, orientation} using user-variables. With this I think you can place any kind of image (portrait or landscape) correctly by using width, height, and rotation.
I picked up some images of cows, 'spider', 'hacker' and 'mill' and have them renamed as {chap-cover-1, ... chap-cover-6} for a total of 6 chapter images.
%%% start example \definepageinjectionalternative [chapter:image] [renderingsetup=pageinjection:chapter:image]
\startsetups [pageinjection:chapter:image] \clip [width=\framedwidth,height=\framedheight] {\centerbox{% \externalfigure [\dummyparameter{name}] [%factor=, width=\structureuservariable{width}, height=\structureuservariable{height}, orientation=\structureuservariable{rotation}]% }} \stopsetups
\definepageinjection [chapter:start] [empty] [page=left]
\definepageinjection [chapter:insert] [previouspage] [alternative=chapter:image, pagestate=stop]
\setuphead [chapter] [beforesection={\pageinjection[chapter:start]}, insidesection={\pageinjection[chapter:insert][name=\structureuservariable{image}]}]
\setuphead [chapter] [beforesection={\pageinjection[chapter:start]}, insidesection={\pageinjection[chapter:insert][name={chap-cover-\namedheadnumber{chapter}}]}]
\setuppagenumbering [alternative=doublesided]
\setupexternalfigures [location=default]
\starttext \startchapter [title={Mill}] [rotation=90,width=\paperheight] \dorecurse{7}{\samplefile{lorem}} \stopchapter
\startchapter [title={Mill}] [rotation=-90,width=\paperheight] \dorecurse{11}{\samplefile{lorem}} \stopchapter
\startchapter [title={Mill}] [rotation=-90,width=\paperheight] \dorecurse{7}{\samplefile{lorem}} \stopchapter
\startchapter [title={Mill}] [rotation=90,width=\paperheight] \dorecurse{7}{\samplefile{lorem}} \stopchapter
\startchapter [title={Mill}] [rotation=-45,width=\paperwidth] \dorecurse{11}{\samplefile{lorem}} \stopchapter
\startchapter [title={Mill}] [height=\paperheight] \dorecurse{7}{\samplefile{lorem}} \stopchapter \stoptext %%% end example
Sreeram