Hi there

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

The following code puts a image inside another image but how how could I 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);
?>

    Yeah, I would say image maps too, but it'd be a bit of a challenge - I always had trouble making them work alone, let alone slamming them into a generated image on the fly. :/ You could also maybe look into generating multiple images, and then echoing the relevant sections out with an <a> tag enclosing it, and setting borders/spacing to 0 with CSS.

      Another thought: Use the main image as a background image of a fixed-width/height HTML block element which then contains the clickable button.

        Write a Reply...