Generate dynamic images alongwith other html data.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rithish

    Generate dynamic images alongwith other html data.

    I have a set of images on a server. I want to pick these from the
    database without creating a

    temporary file on the server; and also have some text alongwith it.

    Something like,

    ImageViewer.php
    <?

    print ( "<IMG SRC='GetImage.p hp?strImageId=1 '>" );
    print ( " some description about the image... " );

    print ( "<IMG SRC='GetImage.p hp?strImageId=2 '>" );
    print ( " some description about the image... " );

    ....
    ....

    ?>

    GetImage.php would server me with the image data from the database,
    probably something like

    this.
    <?

    .... Create database connection ...
    .... Get image data from database depending on strImageId ...

    header ( "Content-Type: Image/gif" );
    print ( $image_data );

    ?>

    GetImage.php gives the image alright.. ( I called
    http://my_server.com/GetImage.php?strImageId=1

    ). However, what I want is a combination of both html and text.

    Is it possible to acheive what I am trying to??

    Any help would be greatly appreciated.

    Regards,
    Rithish.
  • Kevin Thorpe

    #2
    Re: Generate dynamic images alongwith other html data.

    Rithish wrote:[color=blue]
    > I have a set of images on a server. I want to pick these from the
    > database without creating a
    >
    > temporary file on the server; and also have some text alongwith it.
    >
    > Something like,
    >
    > ImageViewer.php
    > <?
    >
    > print ( "<IMG SRC='GetImage.p hp?strImageId=1 '>" );
    > print ( " some description about the image... " );
    >
    > print ( "<IMG SRC='GetImage.p hp?strImageId=2 '>" );
    > print ( " some description about the image... " );
    >
    > ...
    > ...
    >
    > ?>
    >
    > GetImage.php would server me with the image data from the database,
    > probably something like
    >
    > this.
    > <?
    >
    > ... Create database connection ...
    > ... Get image data from database depending on strImageId ...
    >
    > header ( "Content-Type: Image/gif" );
    > print ( $image_data );
    >
    > ?>
    >
    > GetImage.php gives the image alright.. ( I called
    > http://my_server.com/GetImage.php?strImageId=1
    >
    > ). However, what I want is a combination of both html and text.
    >
    > Is it possible to acheive what I am trying to??
    >
    > Any help would be greatly appreciated.
    >
    > Regards,
    > Rithish.[/color]

    A php script can either return HTML or an Image, not both. You'll have
    to have two scripts, one to generate the HTML <img> tag and caption and
    one to generate the image.

    Alternatively you could use the image library to write the text on top
    of the image.

    Comment

    • Dennis Biletsky

      #3
      Re: Generate dynamic images alongwith other html data.


      "Rithish" <rithish@dacafe .com> ???????/???????? ? ???????? ?????????:
      news:fdacfdda.0 405120153.73c0e dab@posting.goo gle.com...[color=blue]
      > I have a set of images on a server. I want to pick these from the
      > database without creating a
      >
      > temporary file on the server; and also have some text alongwith it.
      >
      > Something like,
      >
      > ImageViewer.php
      > <?
      >
      > print ( "<IMG SRC='GetImage.p hp?strImageId=1 '>" );
      > print ( " some description about the image... " );
      >
      > print ( "<IMG SRC='GetImage.p hp?strImageId=2 '>" );
      > print ( " some description about the image... " );
      >
      > ...
      > ...
      >
      > ?>
      >
      > GetImage.php would server me with the image data from the database,
      > probably something like
      >
      > this.
      > <?
      >
      > ... Create database connection ...
      > ... Get image data from database depending on strImageId ...
      >
      > header ( "Content-Type: Image/gif" );
      > print ( $image_data );
      >
      > ?>
      >
      > GetImage.php gives the image alright.. ( I called
      > http://my_server.com/GetImage.php?strImageId=1
      >
      > ). However, what I want is a combination of both html and text.
      >
      > Is it possible to acheive what I am trying to??
      >
      > Any help would be greatly appreciated.
      >
      > Regards,
      > Rithish.[/color]

      Try exclude you HTML tags from php-script like this
      ImageViewer.php
      <?php
      .......
      ?>
      <IMG SRC='GetImage.p hp?strImageId=1 '>
      <SPAN> some description about the image... </span>

      <IMG SRC='GetImage.p hp?strImageId=2 '>
      <SPAN> some description about the image... </SPAN>
      <?php
      ...
      ...

      ?>


      Comment

      • Dennis Biletsky

        #4
        Re: Generate dynamic images alongwith other html data.


        "Dennis Biletsky" <ufafa@ua.fm> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
        news:c7stgs$2t4 f$1@fortress.in tercom.net.ua.. .[color=blue]
        >
        > "Rithish" <rithish@dacafe .com> ???????/???????? ? ???????? ?????????:
        > news:fdacfdda.0 405120153.73c0e dab@posting.goo gle.com...[color=green]
        > > I have a set of images on a server. I want to pick these from the
        > > database without creating a
        > >
        > > temporary file on the server; and also have some text alongwith it.
        > >
        > > Something like,
        > >
        > > ImageViewer.php
        > > <?
        > >
        > > print ( "<IMG SRC='GetImage.p hp?strImageId=1 '>" );
        > > print ( " some description about the image... " );
        > >
        > > print ( "<IMG SRC='GetImage.p hp?strImageId=2 '>" );
        > > print ( " some description about the image... " );
        > >
        > > ...
        > > ...
        > >
        > > ?>
        > >
        > > GetImage.php would server me with the image data from the database,
        > > probably something like
        > >
        > > this.
        > > <?
        > >
        > > ... Create database connection ...
        > > ... Get image data from database depending on strImageId ...
        > >
        > > header ( "Content-Type: Image/gif" );
        > > print ( $image_data );
        > >
        > > ?>
        > >
        > > GetImage.php gives the image alright.. ( I called
        > > http://my_server.com/GetImage.php?strImageId=1
        > >
        > > ). However, what I want is a combination of both html and text.
        > >
        > > Is it possible to acheive what I am trying to??
        > >
        > > Any help would be greatly appreciated.
        > >
        > > Regards,
        > > Rithish.[/color]
        >
        > Try exclude you HTML tags from php-script like this
        > ImageViewer.php
        > <?php
        > ......
        > ?>
        > <IMG SRC='GetImage.p hp?strImageId=1 '>
        > <SPAN> some description about the image... </span>
        >
        > <IMG SRC='GetImage.p hp?strImageId=2 '>
        > <SPAN> some description about the image... </SPAN>
        > <?php
        > ...
        > ...
        >
        > ?>
        >
        >[/color]
        By the way I have checked your variant and it works too. So if your script
        doesn't work it happens due to another reason.


        Comment

        Working...