【发布时间】:2012-10-11 01:40:30
【问题描述】:
我在做什么
通过 javascript 生成动态图像 基于查询字符串中指定的一些变量。我正在在 PHP 网站中使用它。
我需要什么
这里的重点是我想在javascript中发送这个动态生成的图像,以作为图像标题显示在页面上。
我正在使用什么
带有 APACHE 服务器的 PHP (wamp)
我需要的类似示例
http://chart.googleapis.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World
这是一个 Google Chart API,点击上述 URL 后,它会根据查询字符串中指定的参数返回一个 PNG 图像。
我已经尝试了很多,但仍然无法达到成功点。
只是,为了向您展示我在这里所做的是代码
我的代码部分
/*
Logic to generate a canvas based on some parameters goes here
*/
// Canvas to Image
var img = canvas.toDataURL("image/png");
/*
My goal is to set this image to header of the page,
so that when the page is hit, an image is returned,
just like the Google Chart API thing mentioned above
*/
【问题讨论】:
-
+1 表示一个非常明确的问题。谷歌搜索
save canvas image php时,我可以看到一些好看的热门歌曲 - 看看它们。 Save Canvas image (Post the data string to PHP) 是重复的,但我不太喜欢这个解决方案 - Ajax 解决方案会更优雅 -
@Pekka 感谢您的参考。请注意,我不想保存文件,我只想使用动态生成的图像对象作为图像标题发送
-
我不明白你所说的“图片标题”是什么意思,你能详细说明一下吗?
-
你检查过我提到的谷歌网址吗??
-
通过返回Image Header,我的意思是一样的,就是当你点击时,你返回的URL带有一个Image
标签: php javascript image http-headers mime