Added global variables for simplicity.

$imgWidth and $imgBorder