The realization of single / multi-frame image upload with dolphins (DolphinPHP), how to get the picture path

      Upload pictures with a framework to achieve is very simple, not to say, and then implement the mechanism of this framework is that, we select the picture, click Upload, he will be saved in the picture uploads, to the time of day and random letters as the name of the picture, then return numbers, the figure is this image of the id, required path, only through this id, use get_file_path ($ id) can get his specific path, but we need the image path is generally http: / /192.168.1.105/uploads/images/20190802/899cddd590ba116820b4e8227882709b.jpg , we only need to look like a mosaic, http:.. // "$ _ SERVER [ 'SERVER_NAME'] get_file_path ($ vv) ;, http or https, and is the current domain name or server name, and then picture that we address it.

For example, then we need to return multiple sets of data to the front end, how the digital conversion path into a picture of it? My code is

 $data=Db::name('residence')->alias('a')
                 ->join('dp_area e','a.area_id=e.id')
                 ->join('dp_fund f','a.fund_id=f.id')
                 ->join('dp_address g','a.qu=g.id')
                 ->field('a.id,a.name,a.status,a.price,a.type,a.pic,g.qu,a.quan,e.rname,f.fprice')
                 ->where('new','=','1')
                 ->order('id')
                 ->page($page,5)
                 ->select();
$arr=array();      
             foreach ($data as $k => $v) {
                 foreach ($v as $kk => $vv) {
                      if ($kk=="pic") {
                        V $ [$ KK] = " HTTP: // " . $ _ SERVER [ ' the SERVER_NAME ' ] .get_file_path ($ VV);   // replace the image into a particular path id       
                      }          
                  }    
                $ ARR [$ K] = V $; / / picture id changed to specific data paths 
            }

Probably like this.

Guess you like

Origin www.cnblogs.com/cyk2/p/11328484.html