$type = exif_imagetype($srcimg);
switch($type) {
    case 1:
        $simg = imagecreatefromgif($srcimg);
        break;
    case 3:
        $tmp = imagecreatefrompng($srcimg);
        $w = imagesx($tmp);
        $y = imagesy($tmp);
        $simg = imagecreatetruecolor($w, $y);
        $bg =imagecolorallocate($simg, 255, 255, 255);
        imagefill($simg, 0, 0, $bg);
        imagecopyresized($simg, $tmp, 0, 0, 0, 0,$w, $y, $w, $y);
        break;
}

 

相关文章:

  • 2022-02-24
  • 2022-02-26
  • 2021-12-04
  • 2021-12-26
  • 2021-12-22
  • 2022-02-19
猜你喜欢
  • 2022-12-23
  • 2021-12-13
  • 2021-11-20
  • 2021-12-29
  • 2021-12-27
  • 2022-12-23
  • 2021-11-20
相关资源
相似解决方案