function testUsagePng() { $writer = new \Core3\Writer\Barcode2D\Qrcode(); $data = $writer->renderAsPng('hello world :-)'); $this->assertInternalType('string', $data); $this->assertGreaterThanOrEqual(100, strlen($data)); $reader = new \Core3\Reader\BinaryData\Image(); $this->assertEquals(true, $reader->isPngData($data)); }
function testAttachAndEmbedHtmlImage() { // NOTE this shows how to embed attached image in html mail $mailer = new \Core3\Client\Mailer(); $mailer->setFrom('*****@*****.**'); $mailer->addRecipient($this->toAddress); $mailer->setSubject('attached embedded image mail åäö'); $qr = new \Core3\Writer\Barcode2D\Qrcode(); $data = $qr->renderAsPng('hello world :-)'); $contentId = $mailer->embedData($data, 'qr.png', 'image/png'); $msg = '<b>hello</b> world åäö!' . '<img src="cid:' . $contentId . '"/>'; // <- embeds attached image in the mail $mailer->sendHtml($msg); }