PHP to generate images

public function get_image () { 
        header ( ' Content-of the type: Image / jpeg " ); 
    
        $ name =" Sibelius small Xiaofeng "; 
        $ Age =" 24-"; 
        $ DATE = DATE ( " the Y-j in n May Day " , Time ()); 
    
        $ IM = as imagecreatetruecolor ( 640 , 1080 );            // set the canvas picture size (640, 1080) 
        $ imagecreatefromjpeg BG = ( 'Hong-gc.jpg');    // set the background image 
        to imagecopy ($ IM, BG $, 0 , 0 , 0 , 0 , 640 , 1080);              // background image copied to the corresponding position canvas 
        imagedestroy ($ BG);                               // destruction background image 
        $ font = __DIR__. ' /ARIALUNI.TTF ' ;                // set the font           
        $ fontcolor = imagecolorallocate ($ IM, 254 , 251 , 203 );   // color 
    
        / * write the contents * / 
        imagettftext ($ IM, 16 , 0 , 108 , 310 , fontcolor $, $ font, $ name);        // write the name 
        imagettftext ($ IM, 16, 0 , 108 , 310 , fontcolor $, $ font, $ name);        // set bold 
        imagettftext ($ IM, 16, 0, 470, 950, fontcolor $, $ font, $ Age);    // write Age 
        imagettftext ($ IM, 16 , 0 , 470 , 950 , fontcolor $, $ font, $ DATE);    // write time 
    
    
        imagejpeg ($ IM);      // generate jpeg format images 
        imagedestroy ($ IM);   // destruction image 
    }

 

Display image function can be accessed directly change

Images may be dynamically generated, a parameter corresponding to the inside with access connection, after receiving image generated

 

Guess you like

Origin www.cnblogs.com/xbxxf/p/11572105.html