$ Width = 310; // The width of the canvas. $ Height = 360; // canvas height $ Im = imagecreate ($ width, $ height ); $ Img2 = imagecreatefrompng ("$ url"); // Obtain the QR code $ Im_WH = getimagesize ("$ url"); // Obtain the attributes of the QR code image. $ Im_W = $ im_WH [0]; $ Im_H = $ im_WH [1]; $ White = ImageColorAllocate ($ im, 255,255,255); // defines the white background color. $ Black = ImageColorAllocate ($ im, 0); // defines the black font color. $ Rectangelcolor = ImageColorAllocate ($ im, 150,150,150); // defines the border color. Imagerectangle ($ im, $ width-1, $ height-1, $ rectangelcolor); // draw a border Imagettftext ($ im, 15,330, $ black, 'C: WINDOWSFontsarial. Ttf', "$ proid"); // write the product id Imagecopy ($ im, $ img2, 5, 5, $ im_W, $ im_H); // merge two images $ Images = mrand4B (). time (). '.jpg '; // New image name $ Path = $ _ SERVER ['document _ root']. '/static/downloadpic/'. $ images; // Image path Imagejpeg ($ im, $ path); // generate a new graph and place it in the specified path. Imagedestroy ($ im); // release memory Return $ images; // The name of the image to be saved to the database. |