130x81 boyutunda bir görüntüyü yeniden boyutlandıran ve 130x130 görüntüye ekleyen bir resize betikim var. Imagecopyresampled işlevi çalıştırıldığında, temel görüntü olsa bile, kalan alana siyah bir arka plan katar. beyazdır. Aşağıdaki kod, bazı yardımları gerçekten takdir edebilirim.php imagecopyresampled siyah arka plan ekler
benim yarattığım 130x130 dosya php yönünde birleşmek çalışıyorum resimdir: Birden fazla yazılarda okudum
$width = 130;
$height = 130;
$filename = 'process-add.jpg'; //130x81px jpg
$this->_image = imagecreatefromjpeg($filename);
$background = imagecreatetruecolor(130,130);//create the background 130x130
$whiteBackground = imagecolorallocate($background, 255, 255, 255);
imagefill($background,0,0,$whiteBackground); // fill the background with white
imagecopyresampled($background, $this->_image,(130-$width)/2,(130-$height)/2, 0, 0, $width, $height, $width, $height); // copy the image to the background
ImageJpeg ($background,null,100); //display
eklemek için:
imagealphablending($background, false);
düzeltmek gerekir koduna o, ama hiçbir fark yaratmıyor.
Şimdiden teşekkürler!