CRM-14646 - ensure thumb sizes correctly calculated.

----------------------------------------
* CRM-14646: new image display upgrade code not optimized, can result in error
  https://issues.civicrm.org/jira/browse/CRM-14646