How to add four little images to my PHP webpage

Discussion in 'Programming' started by TrafficSupply, Jul 23, 2009.

  1. #1
    I need to add 4 jpg's to a php page. I am a little rusty on my php. I will PM the site details to anyone willing to point me in the right direction. I have all the code so this should be pretty easy. It is a fairly large website with css and I think that is what is confusing me.

    I would really appreciate any help!
     
    TrafficSupply, Jul 23, 2009 IP
  2. jbrooksuk

    jbrooksuk Active Member

    Messages:
    127
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    81
    #2
    PHP pages are still interpreted as HTML, only the server does the backend PHP code.

    I don't see the problem here?

    <img src="jpeg1.jpg" alt="" />
    Code (markup):
    Is that it?
     
    jbrooksuk, Jul 23, 2009 IP
  3. proson

    proson Well-Known Member

    Messages:
    573
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    130
    #3
    there are two ways to do it.
    one use the echo command and the other way is to wrap the HTML code outside the php code/

    eg. use of echo
    
    <?php
    
    //some other php code here
    
    /*php code for image start*/
    
    echo "<img src=\"http://www.abc.com/images/someimage.jpg\" alt=\"some descriptive text\">";
    ?>
    
    Code (markup):
    use of HTML code which's located outside of the PHP code
    
    <?php
    //some php code here
    ?>
    <!-- normal HTML code starts-->
    <img src="http://www.abc.com/images/somePictures.jpg" alt="someDescriptiveTextHere">
    
    Code (markup):
    Hopes that help
     
    proson, Jul 23, 2009 IP
  4. TrafficSupply

    TrafficSupply Well-Known Member

    Messages:
    163
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    103
    #4
    Yeah...I got that part....I am struggling with the placment. So...I have this code below, which is referenceing a picture on the left hand side of my page. I want to add 4 more pics right under it....How do I place more pics directly under under this on?

    code

    <!-- leftimage -->
    <div id="leftimage"><img src="images/picture.jpg" alt="workers" width="250" height="244" /></div>

    Is it getting its position from (<div id="leftimage">)? If so that code is in a css and looks like this.

    #leftimage {
    position: relative;
    top: 0px;
    width: 250px;
    float: left;

    I am just a little over my head.....which does not take much.
    Thanks for the help!
     
    TrafficSupply, Jul 23, 2009 IP
  5. eamiro

    eamiro Well-Known Member

    Messages:
    274
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    123
    #5
    Try to use <br /> after each picture, or create a vertical div of 250px width and put the images inside it.

    use .leftimage instead of #leftimage, then <img class="leftimage" src="" alt="" />

    (In fact, this is not a php problem but a CSS one!)
     
    eamiro, Jul 23, 2009 IP