'HTML PHP Image URL Call
I have an image URL, for example, http://URL/123.jpg
. I can view the image in the browser, but it's not working when using the <img>
tag in PHP. It's not working, and the idea is somehow not displayed.
echo "<img src=\"http://URL/123.jpg\" style=\"width:11%;height:auto;margin-left: 570px;margin-top: 170px;\">";
Any idea?
Solution 1:[1]
For php I use '' and for html the "" quotation marks.
Don't know if it's gonna solve your issue tho. Maybe the height:auto;
is the problem. I think you can even delete it, if you set the width the height should be auto by default.
echo '<img src="http://test.com/123.jpg" style="width:11%;margin-left: 570px;margin-top: 170px;" />';
Solution 2:[2]
Use Normal HTML syntax, include your php then save file as .php
<!DOCTYPE html>
<html>
<body>
<img src="https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Ftse1.mm.bing.net%2Fth%3Fid%3DOIP.GONAZbNLqDhBj8q4CpTnCQHaLH%26pid%3DApi&f=1" style="width:100px;height:auto;margin-left: 570px;margin-top: 170px;"/>
<!--your php file-->
<?php include 'footer.php';?>
</body>
</html>
Don't forget you have to save this file as PHP.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Kip |
Solution 2 | hhelsinki |