Forum


Replies: 3   Views: 2524
...get the size of an image in a word file?
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by ralfjahr  · 12-06-2018 - 08:52

Hi, thanks for your response. We just tried getDocxPathqueryInfo, found the image, but cannot see width or height. Are we missing anything? Thank you in advance, best regards -- Ralf

 

$sheet = new CreateDocxFromTemplate(
                sfConfig::get("sf_app_template_dir") . "/" . 'badge-sheet.docx'
);

$reference_node = array(
        // "type" => "image",
        // "attributes" => ["descr" => '$LOGO$']
        'customQuery' => '//w:drawing[descendant::wp:docPr[contains(@descr, "$LOGO$")]]',
);

$info = $sheet->getDocxPathQueryInfo($reference_node);
var_dump($info);
var_dump($info["elements"][0]);
die("A");
array(3) {
  ["elements"]=>
  object(DOMNodeList)#472 (1) {
    ["length"]=>
    int(6)
  }
  ["length"]=>
  int(6)
  ["query"]=>
  string(61) "//w:drawing[descendant::wp:docPr[contains(@descr, "$LOGO$")]]"
}

object(DOMElement)#479 (17) {
  ["tagName"]=>
  string(9) "w:drawing"
  ["schemaTypeInfo"]=>
  NULL
  ["nodeName"]=>
  string(9) "w:drawing"
  ["nodeValue"]=>
  string(12) "444198233900"
  ["nodeType"]=>
  int(1)
  ["parentNode"]=>
  string(22) "(object value omitted)"
  ["childNodes"]=>
  string(22) "(object value omitted)"
  ["firstChild"]=>
  string(22) "(object value omitted)"
  ["lastChild"]=>
  string(22) "(object value omitted)"
  ["previousSibling"]=>
  string(22) "(object value omitted)"
  ["attributes"]=>
  string(22) "(object value omitted)"
  ["ownerDocument"]=>
  string(22) "(object value omitted)"
  ["namespaceURI"]=>
  string(60) "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
  ["prefix"]=>
  string(1) "w"
  ["localName"]=>
  string(7) "drawing"
  ["baseURI"]=>
  string(70) "file:/C:/Users/dflagner/Documents/Shared%20Folder/p-trout-planner/web/"
  ["textContent"]=>
  string(12) "444198233900"
}
A