Changeset 1632 for trunk/docx4j/src/main
- Timestamp:
- 08/01/11 13:53:24 (10 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docx4j/src/main/java/org/docx4j/model/datastorage/BindingHandler.java
r1449 r1632 19 19 import org.apache.commons.codec.binary.Base64; 20 20 import org.apache.log4j.Logger; 21 import org.apache.xmlgraphics.image.loader.ImageSize; 21 22 import org.docx4j.XmlUtils; 22 23 import org.docx4j.dml.wordprocessingDrawing.Inline; … … 315 316 try { 316 317 cxl = Long.parseLong(cx); 317 cyl = Long.parseLong(c x);318 cyl = Long.parseLong(cy); 318 319 } catch (Exception e) {} 319 if (cxl==0 || c xl==0) {320 if (cxl==0 || cyl==0) { 320 321 // Let BPAI work out size 321 322 log.debug("image size - from image"); … … 325 326 // Use existing size 326 327 log.debug("image size - from content control size"); 328 // Respect aspect ratio of injected image 329 ImageSize size = imagePart.getImageInfo().getSize(); 330 double ratio = (double) size.getHeightPx() / (double) size.getWidthPx(); 331 log.debug("fit ratio: " + ratio); 332 if (ratio > 1) { 333 cxl = (long)((double) cyl / ratio); 334 } else { 335 cyl = (long)((double) cxl * ratio); 336 } 327 337 inline = imagePart.createImageInline( filenameHint, altText, 328 338 id1, id2, cxl, cyl, false);
Note: See TracChangeset
for help on using the changeset viewer.
