Comments (4)
You also have to set the mime type in the header:
header('Content-Type: image/png');
from barcode.
@RebeccaRGB Thanks for the comment. However, I tried that and it didn't help. I tried the mime type in the header inside the php code, as well as inside the header template page where all the page headers are generated.
I am temporarily using the output from direct GET barcode.php results, using this line:
echo '<img style="display: inline;-webkit-user-select: none;margin: auto;background-color: hsl(0, 0%, 90%);transition: background-color 300ms;" src="https://.....com/barcode.php?f=png&s=upc-a&d=' . $products_upc . '">';
And even though that works fine, I am curious to find out the reason it doesn't work using
$image = $generator->render_image($symbology, $data, $options);
imagepng($image);
imagedestroy($image);
I use it inside a php generated page, where I am trying to show the product barcode along with the remaining product details.
Thanks again.
from barcode.
You can't just spit out a PNG directly in the middle of an HTML file. It does not work that way.
Using the img tag with barcode.php in the URL is the correct way to do what you're trying to do.
from barcode.
@RebeccaRGB Thanks for the update. So that is the issue. I will use the image tag then. Thanks again.
from barcode.
Related Issues (20)
- Code 128 Error with "+" Symbol HOT 1
- width, height image problem
- UCC-128 ? HOT 1
- Delete gaps - padding HOT 4
- First of all thank you for this great library.
- Multiple fnc1 in ean128 support
- Аztec format generation
- Add support for the other Data Matrix encoding modes (C40, Text, X12)
- Member function on null HOT 1
- how to save barcode img HOT 2
- Can't pass "&" in dmtx or qr HOT 1
- Rendering Error
- Barcode Width Reduction
- breaks by using --> * <-- for check Digit
- Text and barre code different
- Ability to add text above barcode
- Did you every get a solution to this - I can't get this to create the barcode HOT 1
- How to enter an FNC1 character into a ean128 barcode?
- ¿How to decode this?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from barcode.