Storing image path in a variable

让人想犯罪 __ 提交于 2020-01-17 04:18:13

问题


I have a database that stores the path to the users image such as images/profile/950baasfaa88c.jpg. Now when i try to put this into a variable and surround it with image tags, only a blank image comes up not the image itself...

    $profile_picture = $row['profile_image'];

<img src="'.$profile_picture.'" width=50 height=50 />

回答1:


you haven't echo PHP

<img src="'.$profile_picture.'" width=50 height=50 />

should be

<img src="<?= $profile_picture ?>" width=50 height=50 />



回答2:


you need to echo out the value

<img src="<?php echo $row['profile_image']; ?>" width=50 height=50 />


来源:https://stackoverflow.com/questions/11887879/storing-image-path-in-a-variable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!