unknown
unknown

Reputation: 5

How to get image URL to display in PHP

Can't get image URL to display in my code; this is my URL: https://production.cdmycdn.com/webpack/renderer/d7285ffbbd0ca6d1d2179f7d22ea1f67.svg

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

<!DOCTYPE html>
<html>
<head>
<title>PHP Exercise 1: Links and Variables</title>
</head>
<body>
<h1>PHP Exercise 1: Links and Variables</h1>
<p>Use PHP echo and variables to output the
following link information:</p>
<hr>

<?php
$linkName ='<h1> Codecademy <h1>';

$linkURL = '<a href="https://www.codecademy.com">codecademy</a>';
$linkImage = 
'https://production.cdmycdn.com/webpack/renderer/d7285ffbbd0ca6d1d2179f7d22ea1f67.svg';
$linkDescription = 'Learn to code interactively, for free.';


$my_name = "peter";    

echo "<img>" . $linkImage . "</img>"; 



echo $linkName;
    echo "<br>";
echo $linkURL;
    echo "<br>";
echo $linkImage;
    echo "<br>";
echo $linkDescription;    






$linkImage = 'https://production.cdmycdn.com/webpack/renderer/d7285ffbbd0ca6d1d2179f7d22ea1f67.svg';

echo '<img src="data:image/jpeg;base64,">';
?>  






</body>
</html>

Upvotes: 0

Views: 953

Answers (2)

lzbernardo
lzbernardo

Reputation: 196

A link to an image should always be put in the src attribute when you're using the img tag in html.

That means you should be looking for something like "<img src=".$linkImage."></img>" instead of "<img>".$linkImage."</img>"

Of course, that only applies if the problem you're referring to is the fact that there should be an image after the sentence "Learn to code interactively, for free."

Upvotes: 2

Neiko
Neiko

Reputation: 1

enter image description here

Works just fine for me. Try checking php permissions.

Upvotes: 0

Related Questions