printing a dot matrix image through Javascript or PHP using zebra GC420t

Hi

we are developing a desktop based real time application using php and javascript where we take the details of a particular person and print the image of the person. When i tried to print the image of the person it prints the black box.

I want to use the zebra driver not the windows driver. So when the i click the print button it should print through the zebra printer without showing the preview of the print sheet as the windows driver

The first attachment consist of javascript which has parameters passing to the printer(DevDemo.js)

And the second attachment which converts the png image to grf(zpl.php)

I need to print the below image

1542169259154 - Copy.JPEG

but I am getting this image

IMG_20181119_160144952.jpg

please look at the code and provide the solution

Thanks in advance...