Forum


Replies: 2   Views: 1694
Get image alt text and size
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 bkidd  · 07-06-2020 - 13:04

I am currently using this to get the image alt text:

$referenceNode = array( 'customQuery' => '//w:drawing//wp:docPr', ); $contents = $docx->getDocxPathQueryInfo($referenceNode); foreach ($contents['elements'] as $content) { echo $content->getAttribute('descr'); }

I would also like to know the image dimensions.  I have tried to use:

$images = (new Indexer($this->getPath()))->getOutput()['body']['images'];

which has the dimensions but I don't have a way to match the results.

Any suggestions?  Thanks