Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/259.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从MySQL数据库检索图像的高度和宽度_Php_Mysql_Html_Codeigniter - Fatal编程技术网

Php 从MySQL数据库检索图像的高度和宽度

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,

我在MySQL表中有图像位置的url。如何检索该图像的高度和宽度,并将其插入下面的img标记

<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?>" />