English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I got this script


Header ("Content-type: image/png");

$img_handle = imageCreateFromPNG("banner.png");

$color = ImageColorAllocate ($img_handle, 100, 100, 100);

ImageString ($img_handle, 3, 10, 9, "TESTING", $color);

ImagePng ($img_handle);

ImageDestroy ($img_handle);

?>

how can I change the script like that people can enter a text in a input box and the text will be showed on the dynamic image???

2007-07-15 21:49:55 · 2 answers · asked by marks 2 in Computers & Internet Programming & Design

2 answers

Yes, you can do this.

Presumably , there is an input to select image also?
You need an extra input first for the text, call it show.






So previously you would respond to the query

myURL?image=myimg by returning an image.

Now the query is

myURL?image=myimg&show=mytext

This time, in your PHP, if you see show=mytext
then return this HTML using Content-type: text/html :






mytext


The trick is to make the src of the
tag the same as your dynamic image.
This floats the text on top of your image by using z-index.
Adjust the left and top numbers to position your text.
And you can position the divs wherever you like on the page.

Hope this helps.

2007-07-15 22:33:40 · answer #1 · answered by E.M.Bed 5 · 0 0

The image is created on the server. The text is entered on the client machine.
So you need to pass the input data to the server and then have the image displayed.

2007-07-16 05:28:49 · answer #2 · answered by AnalProgrammer 7 · 0 0

fedest.com, questions and answers