How to use php and js to display pgm pictures at the front end

problem description

canvas cannot be displayed directly. It is garbled if I want to read it with php, or tell me how to use php to read pictures in pgm format

the environmental background of the problems and what methods you have tried

check github, and various websites

related codes

 public function scy()
    {
        $file_path = "E:/map.pgm";
        if(file_exists($file_path)) {
            $str = file_get_contents($file_path);//   
            $str = str_replace("\r\n", "<br />", $str);
//            $substr
            echo $str;
        }
    }
        mapview(function (url) {
        zhenmapview(url);
    });
    function mapview(callblack){
//        console.log(886);
//        var cvs =document.getElementById("canvas");
//
//        var ctx =cvs.getContext("2d");
        var img = new Image();
        var Num = Math.random()*10;
        img.src ="__STATIC__/img/map.pgm?"+Num;
//        canvas_mapW = img.width;
//        canvas_mapH = img.height;
//        console.log(canvas_mapW,canvas_mapH);
//        cvs.height = img.height;
//        cvs.width = img.width;
        img.onload=function (){
//            ctx.drawImage(img,0,0);
            callblack(img.src);

        };
        function getEventPosition(ev){
            var x, y;
//        if (ev.layerX || ev.layerX == 0) {  
            y = ev.offsetY;
//        }
            return {x: x, y: y};
        }
        //******************************************************************************************

    }
Dec.24,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf807d-54d21.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf807d-54d21.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?