How do I echo a .png image to the browser?

images php coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
User avatar
New php-forum User
New php-forum User
Posts: 143
Joined: Fri Dec 30, 2011 4:27 am
Location: Liverpool

Wed Feb 29, 2012 8:32 pm

Its a webserver where your images are stored. <img src =" takes a URL or relative location" />

Code: Select all

   // a link to my image
   echo "<img src={$url} />";

   // this should work for yours. 
   $url = "http://localhost/FORM PROCESSING/Climate_Images/Portland Climate Summary for Year " . $item .".png"; 
   echo "<img src={$url} />";  
for fiture reference if you need to use a backslash in a string variable you need to add it twice to escape it \\.

Post Reply