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

images php coding issues or problems here.

Moderators: macek, egami, gesf

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

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

Post by L33R » 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
   $url="http://localhost/sandbox/images/film-cult.png";
   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

Who is online

Users browsing this forum: No registered users and 0 guests