Results 1 to 3 of 3

Thread: How to display image in PHP Page

  1. #1
    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.

  2. #2
    Join Date
    Oct 2005
    Posts
    2,393

    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.

  3. #3
    Join Date
    Feb 2008
    Posts
    1,852

    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>";
    ?>

Similar Threads

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

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,728,472,035.78822 seconds with 17 queries