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.

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

报告相同问题?

悬赏问题

  • ¥15 java大作业爬取网页
  • ¥15 怎么获取欧易的btc永续合约和交割合约的5m级的历史数据用来回测套利策略?
  • ¥15 有没有办法利用libusb读取usb设备数据
  • ¥15 为什么openeluer里面按不了python3呢?
  • ¥15 关于#matlab#的问题:训练序列与输入层维度不一样
  • ¥15 关于Ubuntu20.04.3LTS遇到的问题:在安装完CUDA驱动后,电脑会进入卡死的情况,但可以通过键盘按键进入安全重启,但重启完又会进入该情况!
  • ¥15 关于#嵌入式硬件#的问题:树莓派第一天重装配置python和opencv后第二天打开就成这样,瞎捣鼓搞出来文件夹还是没把原来的界面调回来
  • ¥20 Arduino 循迹小车程序电路出错故障求解
  • ¥20 Arduino 循迹小车程序电路出错故障求解
  • ¥15 C++数组中找第二小的数字程序纠错