मैं एक आकार बदलने छवि स्क्रिप्ट है कि एक 130x81 छवि लेता है और एक 130x130 छवि में जोड़ लेता है, imagecopyresampled समारोह चलाता है जब यह, अंतरिक्ष उस पर छोड़ दिया जाता है में एक काले रंग की पृष्ठभूमि कहते हैं भी आधार छवि हालांकि सफेद है। नीचे कोड, मैं वास्तव में कुछ मदद की सराहना कर सकता था।php imagecopyresampled कहते हैं काले रंग की पृष्ठभूमि
छवि मेरे द्वारा बनाए गए 130x130 फ़ाइल php पर मिलने के लिए कोशिश कर रहा हूँ है:
$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
मैं कई पदों पर पढ़ा है जोड़ने के लिए:
imagealphablending($background, false);
कोड है जो ठीक करना चाहिए में यह, लेकिन इससे कोई फर्क नहीं पड़ता है।
अग्रिम धन्यवाद!