web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / QRcode logo generation...
Power Apps
Unanswered

QRcode logo generation using PHP script in PowerApps

(0) ShareShare
ReportReport
Posted on by

I have used google api URL as below to generate QR code.

 

"https://chart.googleapis.com/chart?cht=qr&chl=" &TextInput1_1 &"%0A"&TextInput2_1 &"%0A"
&TextInput3_1 &"&chs=100x100"

 

Now I need to bring logo inside the qrcode image. Google Api provided the below PHP code. May I know how to convert it to work on PowerApps

 

 

<?php
/**
* QR Code + Logo Generator
*
* http://labs.nticompassinc.com
*/
$data = isset($_GET['data']) ? $_GET['data'] : 'http://labs.nticompassinc.com';
$size = isset($_GET['size']) ? $_GET['size'] : '200x200';
$logo = isset($_GET['logo']) ? $_GET['logo'] : FALSE;

header('Content-type: image/png');
// Get QR Code image from Google Chart API
// http://code.google.com/apis/chart/infographics/docs/qr_codes.html
$QR = imagecreatefrompng('https://chart.googleapis.com/chart?cht=qr&chld=H|0&chs='.$size.'&chl='.urlencode($data));
if($logo !== FALSE){
$logo = imagecreatefromstring(file_get_contents($logo));

$QR_width = imagesx($QR);
$QR_height = imagesy($QR);

$logo_width = imagesx($logo);
$logo_height = imagesy($logo);

// Scale logo to fit in the QR Code
$logo_qr_width = $QR_width/3;
$scale = $logo_width/$logo_qr_width;
$logo_qr_height = $logo_height/$scale;

imagecopyresampled($QR, $logo, $QR_width/3, $QR_height/3, 0, 0, $logo_qr_width, $logo_qr_height, $logo_width, $logo_height);
}
imagepng($QR);
imagedestroy($QR);
?>

Categories:
I have the same question (0)
  • pontusofsweden Profile Picture
    255 on at

    Hi!

     

    You dont need to convert the PHP. Just use the API url ("https://chart.googleapis.com/chart?cht=qr&chl=" &TextInput1_1 &"%0A"&TextInput2_1 &"%0A"
    &TextInput3_1 &"&chs=100x100") as the Image property of the Image. Works for me 🙂

     

    BR

    Pontus

  • Community Power Platform Member Profile Picture
    on at

    Hi @pontusofsweden,

        Thanks for checking.  I am able to view QRcode using image. But my request is to display my company logo at the center of the QRcode as in the below image.  The PHP Code I posted will help to achieve it.  Any other way to bring logo in QRcode?

     

    azhicon_0-1606381801256.png

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard