Problem loading an Image

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • db2dbdba
    New Member
    • Mar 2008
    • 19

    Problem loading an Image

    Hello all,

    I am newbie to PHP.
    I am running PHP on Apache2 on Linux and I have some 6 pages for PHP.
    All PHP pages are working fine in accessing DB.

    Now the problem is, I want to keep an image(GIF or JPG or anykind of image) on the page but couldn't keep the images.
    If have included an image file in the folder
    Code:
    /usr/local/apache2/htdocs/pwdall
    pwdall contains my PHP files.

    suggest me where i am going wrong and how to include the images on the webpage.

    Thanks for the help.
  • coolsti
    Contributor
    • Mar 2008
    • 310

    #2
    It sounds to me like you need some basic understanding of how HTML works with a web browser to serve up a page.

    If your image is within the document tree on the server, then you can place it into a page using an HTML image tag, <img url="your file name here" >.

    Do a search for how an image tag works and the various options you can add with in the tag brackets.

    Comment

    • db2dbdba
      New Member
      • Mar 2008
      • 19

      #3
      Originally posted by coolsti
      It sounds to me like you need some basic understanding of how HTML works with a web browser to serve up a page.

      If your image is within the document tree on the server, then you can place it into a page using an HTML image tag, <img url="your file name here" >.

      Do a search for how an image tag works and the various options you can add with in the tag brackets.
      Hi there,

      Thanks so much for the reply.
      I did the same thing and then I posted it.
      Image is not coming up but the link associated with it is working for me.
      It is coming as if I am using an unsupported file.

      Thanks for your time

      Comment

      • ronverdonk
        Recognized Expert Specialist
        • Jul 2006
        • 4259

        #4
        Originally posted by coolsti
        If your image is within the document tree on the server, then you can place it into a page using an HTML image tag, <img url="your file name here" >.
        URL is NOT an attribute of the <img> tag, so that will not work. The allowed attribute is src, so your statement would look something like
        Code:
        <img src='pathtoimg/imgname.ext' />
        If this thing does not work, why not show some of your code here? And do it within the appropriate code tags.

        Ronald

        Comment

        • db2dbdba
          New Member
          • Mar 2008
          • 19

          #5
          Originally posted by ronverdonk
          URL is NOT an attribute of the <img> tag, so that will not work. The allowed attribute is src, so your statement would look something like
          Code:
          <img src='pathtoimg/imgname.ext' />
          If this thing does not work, why not show some of your code here? And do it within the appropriate code tags.

          Ronald

          Hi Ronald,

          Thanks so much.
          It worked now. I was using double quotes.

          Thanks,

          Comment

          • ronverdonk
            Recognized Expert Specialist
            • Jul 2006
            • 4259

            #6
            You are welcome, but I wonder what the double quotes have to do with your problem. Can you explain?

            Ronald

            Comment

            • Atli
              Recognized Expert Expert
              • Nov 2006
              • 5062

              #7
              Yea, I was kind of wondering that myself.
              Either type of quotes should work in the HTML. Maybe they were causing PHP parse errors?

              Comment

              • Markus
                Recognized Expert Expert
                • Jun 2007
                • 6092

                #8
                Originally posted by ronverdonk
                You are welcome, but I wonder what the double quotes have to do with your problem. Can you explain?

                Ronald
                I think it's because the original suggestion gave the OP the use of double quotes - something which didn't work. When you gave him a solution that DID work he saw it as the different quotes doing to trick.

                Comment

                • ronverdonk
                  Recognized Expert Specialist
                  • Jul 2006
                  • 4259

                  #9
                  Thanks markus, but OP still has not answered to my question of how he thinks this was solved.

                  Ronald

                  Comment

                  • coolsti
                    Contributor
                    • Mar 2008
                    • 310

                    #10
                    Gosh, sorry, how embarrassing. Of course I meant <img src=" etc. " > in my post. I just answered too quickly!

                    Comment

                    • db2dbdba
                      New Member
                      • Mar 2008
                      • 19

                      #11
                      Originally posted by coolsti
                      Gosh, sorry, how embarrassing. Of course I meant <img src=" etc. " > in my post. I just answered too quickly!
                      Hi All,

                      Sorry for the delay.
                      Even I have no idea of what made it worked. I tried the suggestions with double quotes and it didn't work but when I used the single quotes, it is just working fine.

                      Thanks,
                      R

                      Comment

                      Working...