Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9166179
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T15:05:53+00:00 2026-06-17T15:05:53+00:00

At the moment I am generating a barcode using Shay Anderson’s class (http://www.shayanderson.com/php/php-barcode-generator-class-code-39.htm) and

  • 0

At the moment I am generating a barcode using Shay Anderson’s class (http://www.shayanderson.com/php/php-barcode-generator-class-code-39.htm) and I am able to successfully display the generated barcode in the browser as follows:

$bc = new PrintBarcode('DARP CODE');
$bc->drawVoucher();
$src = $bc->getVoucher();

// Output and free from memory
header('Content-Type: image/jpeg');
imagejpeg($src);

but now I am trying to modify my script to overlay the barcode on top of another image to create a voucher but I can’t seem to get it to work, I just get the broken image icon in Chrome and the following warning in the console:

Resource interpreted as Document but transferred with MIME type image/jpeg

$bc = new PrintBarcode('DARP CODE');
$bc->drawVoucher();
$src = $bc->getVoucher();

header('Content-Type: image/jpeg');

// create actual voucher with barcode overlayed on voucher background 
$bg  = imagecreatefromjpeg('images/voucher.jpg');

imagecopymerge($bg, $src, 0, 0, 0, 0, imagesx($bg), imagesy($bg), 75);

imagejpeg($bg, null, 100);

imagedestroy($bg);

Error reporting is on and I’m getting no wanrings, notices or fatal errors. Any help appreciated.

The only thing I can think of is that from the docs of the barcode class, it generates the barcode as a gif so not sure if I am missing a few steps.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T15:05:54+00:00Added an answer on June 17, 2026 at 3:05 pm

    Turns out the problem was to do with the image I was using as the basis of the merge wasn’t quite right so I re-converted it from a png to jpg properly (first time I downloaded the png I simply did a save as all files to jpeg) using photoshop and it was fine, to clarify, here’s the code:

    $bc = new PrintBarcode('DARP CODE');
    $bc->drawVoucher();
    $src = $bc->getVoucher();
    
    header('Content-Type: image/jpeg');
    
    $bg  = imagecreatefromjpeg('images/voucher.jpg');
    
    imagecopymerge($bg, $src, 40, 380, 0, 0, imagesx($bg), imagesy($bg), 100);
    
    imagejpeg($bg, null, 100);
    
    imagedestroy($src);
    imagedestroy($bg);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

At the moment, I am generating xml and json data using the following code:
I'm generating code in java using SWIG. One of the generated class belongs to
At moment I want to implement picture upload without using any plug-ins. My upload
At the moment I'm using bat file to launch my jar and set the
At the moment I am trying to HTTP response request in my Sharepoint WarmUp
At the moment I'm using all sorts of if statements and substrings in order
How do you get started generating native code for a target platform? I've got
I am using a CMS system, which has a template for generating forms, with
I am using a PHP script to generate an email based on the information
I'm using StructureMap at the moment, generally with convention-based ( Scan() ) auto-configuration, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.