简体   繁体   English

为图像php添加尺寸

[英]Add dimensions to image php

I need to set smaller dimensions as all images are different sizes and need one small size so the page does not stretch, however whenever i add width and height dimensions i keep getting php errors. 我需要设置较小的尺寸,因为所有图像都是不同的尺寸,需要一个小尺寸,因此页面不会伸展,但每当我添加宽度和高度尺寸时,我都会遇到php错误。

Just need width and height for img. 只需要img的宽度和高度。

while ($res = mysql_fetch_array($action)) {
    $output = "<img src=\"../admin/inventory_images/{$res['id']}.jpg\"></img><a href=\"product.php?id={$res['id']}\">{$res['product_name']}</a><br />";
    echo $output;
}

只需将它们放入您的<img>标签中:

$output = "<img src=\"../admin/inventory_images/{$res['id']}.jpg\" height=\"100\" width=\"100\"><a href=\"product.php?id={$res['id']}\">{$res['product_name']}</a><br />";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM