MCPcopy Create free account
hub / github.com/codemistic/Web-Development / encodePNG

Method encodePNG

text-to-qr/lib/phpqrcode/qrencode.php:480–501  ·  view source on GitHub ↗

----------------------------------------------------------------------

($intext, $outfile = false,$saveandprint=false)

Source from the content-addressed store, hash-verified

478
479 //----------------------------------------------------------------------
480 public function encodePNG($intext, $outfile = false,$saveandprint=false)
481 {
482 try {
483
484 ob_start();
485 $tab = $this->encode($intext);
486 $err = ob_get_contents();
487 ob_end_clean();
488
489 if ($err != '')
490 QRtools::log($outfile, $err);
491
492 $maxSize = (int)(QR_PNG_MAXIMUM_SIZE / (count($tab)+2*$this->margin));
493
494 QRimage::png($tab, $outfile, min(max(1, $this->size), $maxSize), $this->margin,$saveandprint);
495
496 } catch (Exception $e) {
497
498 QRtools::log($outfile, $e->getMessage());
499
500 }
501 }
502 }

Callers 1

pngMethod · 0.45

Calls 4

encodeMethod · 0.95
countFunction · 0.85
logMethod · 0.45
pngMethod · 0.45

Tested by

no test coverage detected