Yannick
Yannick

Reputation: 235

Clickable links imagecreatefrompng

At this moment i'm trying to create a dynamic PHP image, and i'm not really sure if it is even possible to have clickable links in the following piece of code:

<?php
$image = "hotelview_val13.png";
$src = 'pixel.png';
putenv('GDFONTPATH=' . realpath('.')); 
$font = 'font.ttf';  //Ubuntu font
$im = imagecreatefrompng($image);

imagealphablending($im, true);
imagesavealpha($im, true);

imagealphablending($src_to_copy, true);
imagesavealpha($src_to_copy, true);

imagealphablending($pg, true);
imagesavealpha($pg, true);

$wc = ImageColorAllocate ($im, 255, 255, 255);
$red = ImageColorAllocate ($im, 255, 0, 0);
$blk = imagecolorallocate($im, 0, 0, 0);

{
    imagettftext($im, 12, 0, 45, 310, $blk, $font , "<A HREF=\"link.php\"     TARGET=\"_blank\">Link</A>");
    imagettftext($im, 12, 0, 45, 330, $blk, $font , "Veel plezier ;)");
}



header("Content-Type: image/png");
Imagepng($im);
ImageDestroy ($im);
?>

What i'm trying to do is to make a clickable link. I've tried to just simply put into the code, but that doesn't work because it displays the code as plain text. Is it possible? If it is, how does it work?

Thanks a lot for your time.

Upvotes: 0

Views: 144

Answers (1)

tmuguet
tmuguet

Reputation: 1165

You cannot embed links in an image. The only way to make a region of an image clickable is, when viewed in a browser, to use an HTML map.

Upvotes: 1

Related Questions