Connecting Tech Pros Worldwide Forums | Help | Site Map

Generate dynamic images alongwith other html data.

Rithish
Guest
 
Posts: n/a
#1: Jul 17 '05
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.php?strImageId=1'>" );
print ( " some description about the image... " );

print ( "<IMG SRC='GetImage.php?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
Guest
 
Posts: n/a
#2: Jul 17 '05

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.php?strImageId=1'>" );
> print ( " some description about the image... " );
>
> print ( "<IMG SRC='GetImage.php?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.
Dennis Biletsky
Guest
 
Posts: n/a
#3: Jul 17 '05

re: Generate dynamic images alongwith other html data.



"Rithish" <rithish@dacafe.com> ???????/???????? ? ???????? ?????????:
news:fdacfdda.0405120153.73c0edab@posting.google.c om...[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.php?strImageId=1'>" );
> print ( " some description about the image... " );
>
> print ( "<IMG SRC='GetImage.php?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.php?strImageId=1'>
<SPAN> some description about the image... </span>

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

?>


Dennis Biletsky
Guest
 
Posts: n/a
#4: Jul 17 '05

re: Generate dynamic images alongwith other html data.



"Dennis Biletsky" <ufafa@ua.fm> сообщил/сообщила в новостях следующее:
news:c7stgs$2t4f$1@fortress.intercom.net.ua...[color=blue]
>
> "Rithish" <rithish@dacafe.com> ???????/???????? ? ???????? ?????????:
> news:fdacfdda.0405120153.73c0edab@posting.google.c om...[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.php?strImageId=1'>" );
> > print ( " some description about the image... " );
> >
> > print ( "<IMG SRC='GetImage.php?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.php?strImageId=1'>
> <SPAN> some description about the image... </span>
>
> <IMG SRC='GetImage.php?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.


Closed Thread