From 2bb01af41357226de90634a82dd407a869af15e8 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Mon, 7 Feb 2011 23:47:43 +0000 Subject: [PATCH] Output width and height parameters for XHTML images. Thanks to Rob Oakes for the patch. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37554 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/InsetGraphics.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp index 3195b5ca0a..f76666fb05 100644 --- a/src/insets/InsetGraphics.cpp +++ b/src/insets/InsetGraphics.cpp @@ -960,6 +960,7 @@ string InsetGraphics::prepareHTMLFile(OutputParams const & runparams) const docstring InsetGraphics::xhtml(XHTMLStream & xs, OutputParams const & op) const { string const output_file = prepareHTMLFile(op); + if (output_file.empty()) { LYXERR0("InsetGraphics::xhtml: Unable to prepare file `" << params().filename << "' for output. File missing?"); @@ -970,10 +971,18 @@ docstring InsetGraphics::xhtml(XHTMLStream & xs, OutputParams const & op) const } // FIXME XHTML - // Do we want to do something with the parameters, other than use them to - // crop, etc, the image? - // Speaking of which: Do the cropping, rotating, etc. - string const attr = "src='" + output_file + "' alt='image: " + // We aren't doing anything with the crop and rotate parameters, and it would + // really be better to do width and height conversion, rather than to output + // these parameters here. + string imgstyle; + if (!params().width.zero()) + imgstyle += "width:" + params().width.asHTMLString() + ";"; + if (!params().height.zero()) + imgstyle += " height:" + params().height.asHTMLString() + ";"; + if (!imgstyle.empty()) + imgstyle = "style='" + imgstyle + "' "; + + string const attr = imgstyle + "src='" + output_file + "' alt='image: " + output_file + "'"; xs << html::CompTag("img", attr); return docstring(); -- 2.39.2