Php 从MySQL数据库检索图像的高度和宽度
我在MySQL表中有图像位置的url。如何检索该图像的高度和宽度,并将其插入下面的img标记Php 从MySQL数据库检索图像的高度和宽度,php,mysql,html,codeigniter,Php,Mysql,Html,Codeigniter,我在MySQL表中有图像位置的url。如何检索该图像的高度和宽度,并将其插入下面的img标记 <img id="profileImg" alt="" height="96" width="87" src="<?=base_url().$row1->imgURI?>" /> imgURI?>“/> 例如,通过使用GD库函数getimagesize():如果数据库中没有存储实际的宽度和高度,则可以使用: " /> 这是使用函数最简单的检索: list($width,
<img id="profileImg" alt="" height="96" width="87" src="<?=base_url().$row1->imgURI?>" />
imgURI?>“/>
例如,通过使用GD库函数getimagesize():如果数据库中没有存储实际的宽度和高度,则可以使用:
" />
这是使用函数最简单的检索:
list($width, $height, $type, $attr) = getimagesize ( base_url() . $row1->imgURI );
<img id="profileImg" alt="" <?=$attr?> src="<?=base_url().$row1->imgURI?>" />
list($width、$height、$type、$attr)=getimagesize(base_url().$row1->imgURI);
伊姆古里?>“/>
带有
伊姆古里?>“/>
另外,如果您可以为图像文件导出本地路径,以避免必须通过其url访问该文件,那就太好了。但我会让你决定。甜心。谢谢你,伙计。也可以将尺寸减小一个百分比吗?height=”“width=“
为90%
list($width, $height, $type, $attr) = getimagesize ( base_url() . $row1->imgURI );
<img id="profileImg" alt="" <?=$attr?> src="<?=base_url().$row1->imgURI?>" />
<?php
list($width, $height, $type, $attr) = getimagesize(base_url() . $row1->imgURI);
?>
<img id="profileImg" alt="" height="<?=$height?>" width="<?=$width?>" src="<?=base_url().$row1->imgURI?>" />