Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 21-01-2009
Member
 
Join Date: Dec 2008
Posts: 35
How to display image in PHP Page

Looking for code for displaying image in PHP page.
I have tried but not working.

Thanks in Advance.
Reply With Quote
  #2  
Old 21-01-2009
Member
 
Join Date: Oct 2005
Posts: 2,389
Re: How to display image in PHP Page

If you have given a Image path saved in the database then try this code.

Code:
// escape from PHP ... ?>

<img src="<? echo $picture; ?>" width="312" height="50" alt="<? echo $picture; ?> (83 bytes)">

<? // starting up PHP again...
It's much simpler to deal with HTML by escaping from PHP scripting and just ouputting plain HTML, and "sprinkling" PHP into certain areas of it. It's also a much more efficient use of processor power. Only use PHP exactly where you need it.
Reply With Quote
  #3  
Old 21-01-2009
Member
 
Join Date: Feb 2008
Posts: 1,848
Re: How to display image in PHP Page

Check with this code.

Code:
<?php
if (eregi("block-Angelo.php",$PHP_SELF)) {
   Header("Location: index.php");
   die();
}
$ufurl = "http://www.gocomics.com/espanol/condorito/";
$content = "<i>ufurl:</i> $ufurl<br>";
$imagefile = "";
if (!($textfile = fopen( "$ufurl", "r"))) {
   $content .= "$ufurl<br> could not be opened<br>";
   die();
}
while (!feof($textfile)) {
   $line = fgets($textfile, 1500);
   if (eregi( ".*<IMG .*SRC=\"(.*)\">.*", $line, $out)) {
      //if (eregi( ".*<center> <img src=".=\"(.*)\">.*", $line, $out)) {
      $imagefile = $out[1];
      break;
   }
}
fclose($textfile);
$content = "<p align=center>";
$content .= "<A HREF=\"http://www.gocomics.com/espanol/condorito\" target=\"_blank\"><IMG SRC=\"$imagefile\" alt=\"Condorito\"></A>";
?>
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to display image in PHP Page"
Thread Thread Starter Forum Replies Last Post
How to Insert an Image into a Web Page with XHTML Udumbu Guides & Tutorials 1 19-05-2011 11:03 PM
Convert any Web Page to Image / PDF Flux Software Development 5 19-06-2009 09:03 PM
CSS : Changing background image and length of a page to 100% Yaropolk Software Development 4 20-05-2009 03:21 PM
Upload image randomly with JavaScript Page Zubeen Software Development 3 25-02-2009 02:54 PM
IE 7 cannot display the web page JoClarke Technology & Internet 2 22-01-2009 11:17 AM


All times are GMT +5.5. The time now is 10:33 PM.