473,395 Members | 1,383 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Adding a clickable button or text into a image with GD

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
3 5540
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

53
by: Kerberos | last post by:
I followed Dan Cederholm's image replacement tutorial, to replace a header tag by a logo. The h1 is clickable if no CSS is applied but it I replace it by the logo, the area isn't clickable anymore...
1
by: Roedy Green | last post by:
..button /* clickable button */ { background-color : #f1f391; color : #7b3e00; border : 3px outset #d2d2d2; margin : 0px 2px 0px 2px; font-family :Arial,Helvetica,sans-serif; font-size : 120%;...
16
by: Picho | last post by:
Hi all, Is there any .NET way (I am not rulling out API usage) to add button(s) to a form's title bar? I found some non-.NET solutions that did actually work in VB6 but not in the ..NET...
1
by: Jonas L | last post by:
I have created a derived version of a normal form, e.g. called MyForm (public class MyForm : System.Windows.Forms.Form). The form is simply specifing a standard icon that we use within the company....
12
by: Ted Weatherly | last post by:
Is it possible to create a clickable time zone map on a web page? Is it as simple as finding an image of world time zones and declaring a bunch image map coordinates? Has someone already done...
1
by: Nathan Sokalski | last post by:
I have navigation that is made out of a table. I did this so that I could dynamically create my "buttons" (the cells formatted using CSS) and avoid creating a new graphic every time I changed the...
1
by: =?ISO-8859-1?Q?Fran=E7ois_de_Dardel?= | last post by:
The URL is: http://dardel.info/tintin/random.html What I want to achieve: When you click a thumbnail, a window opens with a larger copy of the pict _as the background_. I want the new window...
3
by: breakupemail | last post by:
Hello, on my website at http://www.breakupemail.com/ there is a horizontal navigation bar with 6 hyperlinks. Recently, I added a second navigation row below the first, with 2 links. Once this...
2
by: GloStix | last post by:
For some reason, FF likes to put a black underline on all my buttons. No matter what I do, it has the line I've tried displaying as block and cursor, anything.. Also I've been trying to get it so...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.