imagecopy($image, $frame,
($x=max($width-$this->topRightCap[kCapWidth], $this->topLeftCap[kCapWidth])), // Destination x
0, // Destination y
$x, // Source x
0, // Source y
min($this->topRightCap[kCapWidth], $width-$this->topLeftCap[kCapWidth]), // Source width
$this->topRightCap[kCapHeight]); // Source height
imagecopy($image, $frame,
($x=max($width-$this->topRightCap[kCapWidth], $this->topLeftCap[kCapWidth])), // Destination x
0, // Destination y
$x, // Source x
0, // Source y
min($this->topRightCap[kCapWidth], $width-$this->topLeftCap[kCapWidth]), // Source width
$this->topRightCap[kCapHeight]); // Source height