简体   繁体   English

可点击的链接imagecreatefrompng

[英]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映像,但是我不确定在以下代码中是否甚至可以包含可点击的链接:

<?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. 非常感谢您的宝贵时间。

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 . 在浏览器中查看时,使图像区域可单击的唯一方法是使用HTML map

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM