douzhan5262 2015-11-20 10:49
浏览 91
已采纳

使用gd库加载图像

I'm trying to generate a barcode using this: https://github.com/davidscotttufts/php-barcode/.

This method requires to install gd library.

I install this library like this on my linux based server:

$ apt-get install php5-gd

After the instalation I restarded the server and looked if it was instaled like this:

php -m

And it was.

Now I added this line to my code to genarate a barcode(I'm generating the link with the twig function "asset"):

<img alt="testing" src="{{ asset('bundles/kopictadmin/code/barcode.php?text=testing') }}"/> 

This gives my the 'Alt' attribute instead of the picture. I'm generating css just like this only branching of to 'css' folder instead of the 'code' folder.

Somebody any idea whats wrong?

  • 写回答

1条回答 默认 最新

  • douchuanchai2793 2015-11-20 11:10
    关注

    The img tag returns the alt value because the image that you have provided is not a correct image.

    You need to fix the code itself in barcode.php so that the image is properly created and should probably check the result in the browser first so you know that the result of calling barcode.php is actually an image.

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

报告相同问题?

悬赏问题

  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法