dsfasdfsda234234 2011-09-22 15:46
浏览 57

如何用PHP在图像上显示热图?

I have an image (graph) inside a <div> on which accumulated clicks are displayed, so it looks like a mess of dots all over the place.

I'd like to make this "nicer" to look at, and thought heatmaps would be the best option.

How could I implement such a solution?

I'm not particularly adept with PHP or javascript, so any pointers would help.

  • 写回答

2条回答 默认 最新

  • drjltlm156790 2011-09-22 15:55
    关注

    In terms of accumulating clicks, you could simply register a click handler in JS that would work out where on the image the click event occurred. You could then use AJAX (or an alternative method of your choice) to return these clicks to your webserver, and presumably store them somehow.

    With regards to creating heatmaps, you have two potential routes.

    1. You could generate a heatmap image server-side in PHP, using a library such as GD or ImageMagick, and lay this image over your graph.

      This has the upside of not worrying about browser compatibility with the various JS solutions, but it will mean increased server load.

    2. You could also generate the heatmap client-side in JS - there are a whole host of possible ways of doing this.

      This has the nice upside of leaving the hard work to the browser, keeping your server running smoothly. However, you may face issues with browser compatibility.

    In order to fully answer this question, it would be helpful to know a little more about what you have already, what constraints you're placed under, and whether you have any preference as to techniques used!

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题