2015-11-20 10:49


  • php
  • assets
  • barcode
  • gd

I'm trying to generate a barcode using this:

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?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答


  • douchuanchai2793 douchuanchai2793 6年前

    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.

    点赞 评论 复制链接分享