imagescreatetruecolor with a white background

后端 未结 3 1624
半阙折子戏
半阙折子戏 2020-12-31 03:23

I\'m pretty sure I need to use imagefilledrectangle in order to get a white background instead of black on this... just not sure how. I\'ve tried a few ways.



        
3条回答
  •  情深已故
    2020-12-31 04:03

    $targetImage = imagecreatetruecolor($thumbw,$thumbh);
    
    // get the color white
    $color = imagecolorallocate($targetImage, 255, 255, 255);
    
    // fill entire image
    imagefill($targetImage, 0, 0, $color);
    

    imagecolorallocate: http://www.php.net/manual/en/function.imagecolorallocate.php

    imagefill: http://php.net/manual/en/function.imagefill.php

提交回复
热议问题