如何在php-doc中调整图像大小的正确方法


How the correct way to resize image size in php doc

我正试图使用php创建一个包含图像的.doc文件。里面的图像有一个相当大的重量和高度,但我想包括它,而不创建一个新的小版本的图像。

这是我的代码

<?php
    set_time_limit (0);
    header("Content-type: application/vnd.ms-word");
    header("Content-Disposition: attachment;Filename=test.doc");    
?>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
        <title>Hello World</title>
    </head>
    <body>
        <img src="http://localhost/test_zip/img/jesse_what.png" style="max-width:50; width:50;max-height:50; height:50;">
    </body>
</html>

调整大小的正确方法是什么?因为我放置在图像标签中的样式不起作用。

放入px并移除max-width:50max-height:50

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
        <title>Hello World</title>
    </head>
    <body>
        <img src="http://localhost/test_zip/img/jesse_what.png" style="width:50px; height:50px;">
    </body>
</html>

经过一段时间的搜索,我找到了一种方法。因此,我为img标签添加了宽度和高度属性

现在看起来像这个

<img src="http://localhost/test_zip/img/jesse_what.png" width="160" height="200">