This is the mail archive of the docbook@lists.oasis-open.org mailing list for the DocBook project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [docbook] DB-HTML how to scale down too wide imgages (without attr in imagedata)


On Wed, Jul 16, 2003 at 11:10:17AM +0200, Sebastian Fey wrote:
> hi,
> 
> im just customizing the docbook-xsl style sheets for HTML output.
> 
> i got some images that are too wide for to be displayed in the browser.
> 
> is there a way like set a param to "800px" and each image surpassing this
> width will be scaled down?

There is no 'maximum.image.width' parameter, but it might
make a nice feature request.  8^)

> or, if not, is a template possible / existing in the sheets that returns the
> width of an image?

Yes, if you are using Saxon or Xalan, Norm has written some
XSL extension functions that attempt to extract the width
information from an image file.  In html/graphics.xsl, you will
see something like this:

<xsl:variable name="intrinsicwidth">
    <!-- This funny compound test works around a bug in XSLTC -->
    <xsl:choose>
      <xsl:when test="$use.extensions != 0 and $graphicsize.extension != 0">
        <xsl:choose>
          <xsl:when test="function-available('simg:getWidth')">
            <xsl:value-of select="simg:getWidth(simg:new($filename),
                                                $nominal.image.width)"/>
          </xsl:when>
          <xsl:when test="function-available('ximg:getWidth')">
            <xsl:value-of select="ximg:getWidth(ximg:new($filename),
                                                $nominal.image.width)"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:value-of select="$nominal.image.width"/>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:when>
      ...

The simg:getWidth is the Saxon extension, and the
ximg:getWidth is the Xalan extension.
You could use those in a customization to adjust
the width.  Unfortunately, there is no such 
extension for xsltproc yet.

-- 

Bob Stayton                                 400 Encinal Street
Publications Architect                      Santa Cruz, CA  95060
Technical Publications                      voice: (831) 427-7796
The SCO Group                               fax:   (831) 429-1887
                                            email: bobs@sco.com

---------------------------------------------------------------------
To unsubscribe, e-mail: docbook-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: docbook-help@lists.oasis-open.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]