CRM-14646 - optimze image display upgrade code

----------------------------------------
* CRM-14646: new image display upgrade code not optimized, can result in error
  https://issues.civicrm.org/jira/browse/CRM-14646
Merge pull request #3224 from totten/4.4-image-url-idx

CRM-14646 - optimze image display upgrade code