Jump to content

Displaying a centered image without html


Spyderman

Recommended Posts

Hi all,

I'm looking for a way to display an image, centered, using only php. The reason it can't use html is the image I am displaying is a variable $path, and the image will display when I call a function. The code I have now is

<?
$path="imgs/image.jpg";
displayImage();
function displayImage()
{
echo"<img id="img_center" src=$path>";
}
?>

 

but when I am using the 'echo', I am unable to use the $path variable. Which is why I am trying to do it without using html. Thanks alot!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.