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

  • Home
  • SEARCH
  • 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 8816241
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:34:32+00:00 2026-06-14T04:34:32+00:00

Background At our company the less work there is to manually do the better.

  • 0

Background

At our company the less work there is to manually do the better. Our marketing lady approached me and asked if there is a way to automatically generate a business card with PHP. I told her it should not be an issue if she could save the template as a SVG file.

So she did. Editing the text is pretty easy as I just find the detail spaces and replace it with the user input.

The Problem

The biggest issue that I’m having at the moment is the QR Code that I get from the Google Charts API. The QR Code contains the business card data for easy saving to the phone. The QR Code is retrieved with this call to the Google Charts API:

$request = "http://chart.apis.google.com/chart?chs=500x500&cht=qr&chld=M&chl=" . urlencode($vcard);

where $vcard is the VCard that I built with PHP. This works, as the VCard can be used when scanning the QR Code.

What I have tried

Since any image in a SVG file is encoded to text, I tried the following methods:

file_get_contents($request); // Seems the encoding is of as there are weird characters in the result
img2php.class // Downloaded from PHP Classes, but only converts images in a directory

Additional Information

What I have realised is that the QR Code is a PNG that is generated. I don’t know if that will affect the answer.

Also, the current QR Code in the business card is encoded as follows:

<image overflow="visible" width="200" height="200"
xlink:href="data:image/jpeg;base64,/9j/4AAQSkZJRgABAgEBZwFnAAD/
7AARRHVja3kAAQAEAAAAHgAA/+4AIUFkb2JlAGTAAAAAAQMA
EAMCAwYAAAReAAALrQAAHjX/2wCEABALCwsMCxAMDBAXDw0PFxsUEBAUGx8XFxcXFx8eFxoaGhoX
Hh4jJSclIx4vLzMzLy9AQEBAQEBAQEBAQEBAQEABEQ8PERMRFRISFRQRFBE
    ** random gibberish **
saaZZmll6QMgIAGkLbb5qxkhmSE47OSXBN9YXg81d+i5LV36LktWPktmRMsMqSFQrXIRg1v8bjuM
2IBmJtpbymu/Rclq79FyWrv0XJasl5p0mGQqABARbQW4fP8A/s//
2Q==" transform="matrix(0.2003 0 0 0.2003 56.5049 191.0313)">
</image>

Question

Is there a way that I can get the QR Code from Google API and then encode it to string and add it to the SVG template?

  • 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-14T04:34:33+00:00Added an answer on June 14, 2026 at 4:34 am

    And I’ve managed to fix it myself… And by using some more Googling.

    First, pull the image from the Google API:

    $image = file_get_contents('http://chart.apis.google.com/chart?chs=500x500&cht=qr&chld=M&chl=' . urlencode($vcard));
    

    Then just use base64_encode to encode it to a string:

    $image = base64_encode($image);
    

    And that works. The QR Code scans correctly. 😀

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First some background: The company I work for have decided to create an iPhone
The background story: I work for a company that develops and manufactures a commercial
Background I have an ASP.NET site, hosted internally on our company's intranet server. The
Background: I work for a small microsoft based web dev company who is slowly
First a little background. The company I work for writes web based software that
BACKGROUND: Right now, in our company we have a PHP based app to automate
Background: I work for a company who utilizes Sharepoint for Task Management. We develop
Background: Our web app uses the jquery.constrain.js plugin to handle data entry in some
Background Our email vendor supports rss feeds for dynamic content, which we use successfully
I want to change the background color of our apps main window when a

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.