Results 1 to 2 of 2

Thread: Image holder in php

  1. #1
    Join Date
    Aug 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow Image holder in php

    Hi there

    I am after the image link, but written for use in php.
    e.g. the HTML link:
    <img src="/testpic.jpg" width="350" height="350">

    But to be able to work in a php file and display an image on the page calling it.


    I hope this won’t mean anything to lengthy but any help would be most appreciated

  2. #2
    Join Date
    Aug 2007
    Location
    Ohio
    Posts
    79
    Thanks
    0
    Thanked 15 Times in 15 Posts

    Default

    I think you might have several concepts confused here.

    A php file is interpreted, and often turned into HTML. PHP is not a content type. You can't "display an image in a php file." You can however program it to display an image in a certain medium. In this case, it looks like you want to display it in html. Here are some related examples that should help you:

    PHP Code:
    <?php

    // This is a php script... 

    // let's revert to basic html to display the image
    ?>
    <img src="/testpic.jpg" width="350" height="350" />
    <?php

    // Finish whatever we need to do

    ?>
    Or...

    PHP Code:
    <?php

    // This is our php script...

    // Print that image...

    echo "<img src=\"/testpic.jpg\" width=\"350\" height=\"350\" />";

    // Finish whatever we need to do
    ?>
    Or...

    PHP Code:
    <?php

    $filename 
    "/testpic.jpg";
    $width 350;
    $height 350;

    // print that image
    echo "<img src=\"" $filename "\" width=\"" $width "\"  height=\"" $height "\" />";

    ?>

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
  •