Connecting Tech Pros Worldwide Help | Site Map

Adding a clickable button or text into a image with GD

crazychrisy54@hotmail.com
Guest
 
Posts: n/a
#1: Oct 18 '07
Hi there

I just wondered if there is any way using GD to insert a clickable
button or some clickable text into a image? It is possible to create
images for buttons but what if you want a clickable button *inside*
another image.

I don't know if this is along the right lines but the following code
puts a image inside another image. Perhaps I could then make im2
clickable or is it just not possible? Any help would be very much
appreciated!

Thanks
Chris

<?php
$im = ImageCreate(800,800);
$im_color = ImageColorAllocate($im, 0, 255, 0);

$im2 = ImageCreate(200,200);
$im_color2 = ImageColorAllocate($im2, 255, 0, 0);

// copy image into new resource
imagecopy($im, $im2, 0, 0, 0, 0, 60, 60 );

header ("Content-type: image/png");
ImagePNG($im);
?>

Rik Wasmus
Guest
 
Posts: n/a
#2: Oct 18 '07

re: Adding a clickable button or text into a image with GD


On Thu, 18 Oct 2007 16:39:39 +0200, <crazychrisy54@hotmail.comwrote:
Quote:
Hi there
>
I just wondered if there is any way using GD to insert a clickable
button or some clickable text into a image? It is possible to create
images for buttons but what if you want a clickable button *inside*
another image.
>
I don't know if this is along the right lines but the following code
puts a image inside another image. Perhaps I could then make im2
clickable or is it just not possible? Any help would be very much
appreciated!
Please read up on your html. An image will always be just an image. Any
'click'-detection has to come from something else. In html <input
type="image"and imagemaps come to mind.

Also, with HTML, it would be a nightmare to maintain/update images with
fixed button images inside on an update. Just use CSS positioning, which
is most userfriendly and portable.
--
Rik Wasmus
Lars Eighner
Guest
 
Posts: n/a
#3: Oct 18 '07

re: Adding a clickable button or text into a image with GD


In our last episode,
<1192718379.010409.299430@q5g2000prf.googlegroups. com>,
the lovely and talented crazychrisy54@hotmail.com
broadcast on comp.lang.php:
Quote:
Hi there
Quote:
I just wondered if there is any way using GD to insert a clickable
button or some clickable text into a image? It is possible to create
images for buttons but what if you want a clickable button *inside*
another image.
Quote:
I don't know if this is along the right lines but the following code
puts a image inside another image. Perhaps I could then make im2
clickable or is it just not possible? Any help would be very much
appreciated!
You can make an area of an image clickable with the HTML map element.
The clickability is not in the image. It is in the HTML. You can put stuff
in an image that looks like a button, but that doesn't make it clickable.
You can also make parts of an image clickable without putting anything in
the image that looks like a button.
Quote:
Thanks
Chris
Quote:
><?php
$im = ImageCreate(800,800);
$im_color = ImageColorAllocate($im, 0, 255, 0);
Quote:
$im2 = ImageCreate(200,200);
$im_color2 = ImageColorAllocate($im2, 255, 0, 0);
Quote:
// copy image into new resource
imagecopy($im, $im2, 0, 0, 0, 0, 60, 60 );
Quote:
header ("Content-type: image/png");
ImagePNG($im);
?>
--
Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner>
Countdown: 460 days to go.
What do you do when you're debranded?
The Natural Philosopher
Guest
 
Posts: n/a
#4: Oct 18 '07

re: Adding a clickable button or text into a image with GD


crazychrisy54@hotmail.com wrote:
Quote:
Hi there
>
I just wondered if there is any way using GD to insert a clickable
button or some clickable text into a image? It is possible to create
images for buttons but what if you want a clickable button *inside*
another image.
Yup. Its not that hard - there are some ways to do it: Here is mine.

Use a background image in a table cell. Then add clickable text or
another image over the top.

If you specify the table cell size and use non repeating backgrounds of
transperent edged GIFS it needn;t be a reatngular image either.

Quote:
>
I don't know if this is along the right lines but the following code
puts a image inside another image. Perhaps I could then make im2
clickable or is it just not possible? Any help would be very much
appreciated!
>
Thanks
Chris
>
<?php
$im = ImageCreate(800,800);
$im_color = ImageColorAllocate($im, 0, 255, 0);
>
$im2 = ImageCreate(200,200);
$im_color2 = ImageColorAllocate($im2, 255, 0, 0);
>
// copy image into new resource
imagecopy($im, $im2, 0, 0, 0, 0, 60, 60 );
>
header ("Content-type: image/png");
ImagePNG($im);
?>
>
Closed Thread