Hi there

I wish to call an image (.jpg) as a result of an action inside a php script. I've tried various ways to do this, all without success.

Do you have any sample code or suggestions??

cheers
Stephen

    • [deleted]

    have you tried
    echo "<img src=bla.jpg>";

      Hi Vincent

      This works. Many thanks!

      Can't seem to get my alignment and ALT working but will keep trying.

      Regards
      Stephen

        are you enclosing them in brackets?

        you need to put a slash infront of any brackets that you want PHP to echo (to escape them), so you have:

        echo "<img src=\"blah.jpg\" alt=\"blah\" align=\"right\">";

        hope that helps

        jamie

          • [deleted]

          You mean you should escape quotes, not brackets.
          brackets are {}[]<>

            Hi Jamie

            Thanks! Got the ALT working ok.

            For some strange reason, I can't get the image to align center. It seems to stay left. But when I do align=\"right\" it works well. I dunno....anyway, thanks.

            Stephen

              There is no align=center option for the image tag in HTML specs, only left and right (for horizontal alignment anyway). If it's on a horizontal line by itself (like a banner in the top center of a page), you can use a DIV tag like this:

              '<div align=center><img src=blah.jpg></div>'

              If that's no good, maybe you sould use a table. It depends on your layout really.

                It worked! For the benefit of others who want to know, here is the string:

                echo "<div align=center><img src=\"../images/bla.jpg\" alt=\"bla bla\" ></div>";

                Thanks to you all! The benefits of combined knowledge in this forum is truely amazing.

                Cheers
                Stephen

                  Write a Reply...