|
Posted by Anze on 09/18/05 23:51
Hi Martien,
You can't do that - you either send an image or you send the text. URL must
describe just one file. ImagePNG really just outputs the bytes that the
image consists of, and if you add some text to it then it is like adding
text to PNG file. Doesn't make much sense, does it?
The only way to do this is to embed the image in the HTML file. I heard that
it is possible (though I don't know if many browsers support this). Why not
go the usual route (two separate files - HTML and image)?
Regards,
Anze
Martien van Wanrooij wrote:
> Hi all,
>
> Maybe I just didn't enter the right words in google but I am trying to
> find out if a image created with the gd library can be sent together to
> the client with text based content as one page.
> The sample code below shows the image but not the text, probably because
> of the header parameters.
> <?php
> /* this code seems to be compulsory for the image but obviously it
> also
> suppresses all the text I want to send */
> header("Content-type: image/png");
> $string = $_GET['text'];
> $im = imagecreatefrompng("images/button1.png");
> $orange = imagecolorallocate($im, 220, 210, 60);
> $px = (imagesx($im) - 7.5 * strlen($string)) / 2;
> imagestring($im, 3, $px, 9, $string, $orange);
> imagepng($im);
> imagedestroy($im);
> /* the text below doesn't appear */
> echo "kijken of er ook tekst op kan";
> ?>
> Thanks for any suggestions (which also can be a reference to a webpage
> that gives more explanations)
>
> Martien
Navigation:
[Reply to this message]
|