You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
I'm a beginner in coding. I'm trying to print a picture on my thermal printer but i have some error like this :
Fatal error: Uncaught Exception: Failed to load image. in D:\xampp\htdocs\tes\src\Mike42\Escpos\GdEscposImage.php:63 Stack trace: #0 D:\xampp\htdocs\tes\src\Mike42\Escpos\GdEscposImage.php(51): Mike42\Escpos\GdEscposImage->readImageFromGdResource(Object(GdImage)) #1 D:\xampp\htdocs\tes\src\Mike42\Escpos\EscposImage.php(152): Mike42\Escpos\GdEscposImage->loadImageData('tux.png') #2 D:\xampp\htdocs\tes\src\Mike42\Escpos\Printer.php(461): Mike42\Escpos\EscposImage->toRasterFormat() #3 D:\xampp\htdocs\tes\print_struk.php(19): Mike42\Escpos\Printer->bitImage(Object(Mike42\Escpos\GdEscposImage)) #4 {main} thrown in D:\xampp\htdocs\tes\src\Mike42\Escpos\GdEscposImage.php on line 63
Here my code ,
`<?php
error_reporting(E_ALL & ~E_NOTICE);
require 'autoload.php';
use Mike42\Escpos\Printer;
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
use Mike42\Escpos\EscposImage;
use Mike42\Escpos\CapabilityProfiles\SimpleCapabilityProfile;
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
use Mike42\Escpos\GdEscposImage;
Hello,
I'm a beginner in coding. I'm trying to print a picture on my thermal printer but i have some error like this :
Fatal error: Uncaught Exception: Failed to load image. in D:\xampp\htdocs\tes\src\Mike42\Escpos\GdEscposImage.php:63 Stack trace: #0 D:\xampp\htdocs\tes\src\Mike42\Escpos\GdEscposImage.php(51): Mike42\Escpos\GdEscposImage->readImageFromGdResource(Object(GdImage)) #1 D:\xampp\htdocs\tes\src\Mike42\Escpos\EscposImage.php(152): Mike42\Escpos\GdEscposImage->loadImageData('tux.png') #2 D:\xampp\htdocs\tes\src\Mike42\Escpos\Printer.php(461): Mike42\Escpos\EscposImage->toRasterFormat() #3 D:\xampp\htdocs\tes\print_struk.php(19): Mike42\Escpos\Printer->bitImage(Object(Mike42\Escpos\GdEscposImage)) #4 {main} thrown in D:\xampp\htdocs\tes\src\Mike42\Escpos\GdEscposImage.php on line 63
Here my code ,
`<?php
error_reporting(E_ALL & ~E_NOTICE);
require 'autoload.php';
use Mike42\Escpos\Printer;
use Mike42\Escpos\PrintConnectors\WindowsPrintConnector;
use Mike42\Escpos\EscposImage;
use Mike42\Escpos\CapabilityProfiles\SimpleCapabilityProfile;
use Mike42\Escpos\PrintConnectors\FilePrintConnector;
use Mike42\Escpos\GdEscposImage;
$logo = EscposImage::load("tux.png", false);
$variabel = explode('|',$_GET['variabel']);
$profile = SimpleCapabilityProfile::getInstance();
$connector = new WindowsPrintConnector("smb://localhost/88 Printer");
$printer = new Printer($connector, $profile);
$printer->bitImage($logo);
/* Text */
$printer -> feedReverse(5);
$printer -> setJustification(Printer::JUSTIFY_CENTER);
$printer -> selectPrintMode(Printer::MODE_FONT_B);
$printer -> text('No Antrian Anda : '."\n\n");
$printer -> selectPrintMode(Printer::MODE_FONT_A);
$printer -> setTextSize(3, 3);
$printer -> text($variabel[2]."\n\n");
$printer -> selectPrintMode(Printer::MODE_FONT_B);
$printer -> setTextSize(2, 1);
$printer -> text($variabel[3]."\n");
$printer -> selectPrintMode(Printer::MODE_FONT_B);
$printer -> text('Sisa Antrian: ' . $variabel[1]."\n");
$printer -> text('Masa Berlaku Tiket: ' . $variabel[4]." jam\n");
$printer -> text('Terima kasih atas kunjungan Anda '."\n");
$printer -> text($variabel[0]."\n");
$printer -> selectPrintMode(Printer::MODE_FONT_B);
$printer -> feed(1);
$printer -> cut();
$printer -> close();
?>`
Anyone can help?
Thank you before
The text was updated successfully, but these errors were encountered: