douqixia7942 2012-01-08 18:40
浏览 113
已采纳

如何使用url,PHP,GD获取图像作为背景?

I am trying to get image from one IP camera, which has url like http://publicip:1234/mypicture.jpeg

But how do i attache that image to this as background?

  $im = imagecreatefromjpeg('http://publicip/video/meandmyCPU.jpeg');
  //$black = imagecolorallocate($im,255,0,0);
  //              s   x  y
  Imagestring($im,19,70,70,'MY NAME IS!',$black);      
  header('Content-type: image/png');
  imagejpeg($im);
  imagedestroy($im);

But it does not show my texts.

  • 写回答

1条回答 默认 最新

  • dongpan1416 2012-01-08 19:17
    关注

    Are you explicitly loading a font using imageloadfont? I don't think 19 is a valid font identifier, unless you loaded it yourself, and given the docs on imageloadfont, I don't think 19 would be a valid identifier either.

    http://php.net/manual/en/function.imagestring.php

    If so, check that the load succeed, you don't have errors, etc. Assuming it's the text not displaying (your question is somewhat unclear in that it asks about attaching a background, and also says the text doesn't appear, which implies that the image does)

    If the background isn't appearing, check that you can actually open a URL over HTTP - the default config on my webhost disables it as it's a security risk (as one could use it to read in arbitrary data and possible execute it, if for instance, if there's a security hole).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测