Remove Image Whitespace 1.1 2.1.5 Converted by JMilton info['width'] || !$this->info['height']) { return; } $xpos = 0; $ypos = 0; $scale = min($width / $this->info['width'], $height / $this->info['height']); if ($scale == 1) { return; } $new_width = (int)($this->info['width'] * $scale); $new_height = (int)($this->info['height'] * $scale); $xpos = (int)(($width - $new_width) / 2); $ypos = (int)(($height - $new_height) / 2); $image_old = $this->image; $this->image = imagecreatetruecolor($new_width, $new_height); //$background = imagecolorallocate($this->image, 255, 255, 255); //imagefilledrectangle($this->image, 0, 0, $width, $height, $background); imagecopyresampled($this->image, $image_old, 0, 0, 0, 0, $new_width, $new_height, $this->info['width'], $this->info['height']); imagedestroy($image_old); $this->info['width'] = $new_width; $this->info['height'] = $new_height; } ]]>