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).

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

报告相同问题?

悬赏问题

  • ¥50 随机森林与房贷信用风险模型
  • ¥50 buildozer打包kivy app失败
  • ¥30 在vs2022里运行python代码
  • ¥15 不同尺寸货物如何寻找合适的包装箱型谱
  • ¥15 求解 yolo算法问题
  • ¥15 虚拟机打包apk出现错误
  • ¥15 用visual studi code完成html页面
  • ¥15 聚类分析或者python进行数据分析
  • ¥15 三菱伺服电机按启动按钮有使能但不动作
  • ¥15 js,页面2返回页面1时定位进入的设备