By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,844 Members | 1,889 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,844 IT Pros & Developers. It's quick & easy.

Adding a clickable button or text into a image with GD

P: n/a
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);
?>

Oct 18 '07 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Thu, 18 Oct 2007 16:39:39 +0200, <cr***********@hotmail.comwrote:
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
Oct 18 '07 #2

P: n/a
In our last episode,
<11**********************@q5g2000prf.googlegroups. com>,
the lovely and talented cr***********@hotmail.com
broadcast on comp.lang.php:
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!
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.
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);
?>
--
Lars Eighner <http://larseighner.com/ <http://myspace.com/larseighner>
Countdown: 460 days to go.
What do you do when you're debranded?
Oct 18 '07 #3

P: n/a
cr***********@hotmail.com wrote:
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.

>
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);
?>
Oct 18 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.