Looking for code for displaying image in PHP page.
I have tried but not working.
Thanks in Advance.
Printable View
Looking for code for displaying image in PHP page.
I have tried but not working.
Thanks in Advance.
If you have given a Image path saved in the database then try this code.
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.Code:// escape from PHP ... ?>
<img src="<? echo $picture; ?>" width="312" height="50" alt="<? echo $picture; ?> (83 bytes)">
<? // starting up PHP again...
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>";
?>