code: public String getTargetUrl() {
  		if (getImageUrl() != null) {
  			return getImageUrl();
  		}
  
  		Image image = getImage();
  
  		if (image instanceof InternalResource) {
  			return ((InternalResource) image).getTargetUrl();
  		}
  
  		Environment env = getEnvironment();
  		Map<String, String> parameters = env.getHiddenParameters();
  		parameters.put(Environment.TARGET_ID, getTargetId());
  
  		if (Util.empty(getCacheKey())) {
  			// Add some randomness to the URL to prevent caching
  			String random = WebUtilities.generateRandom();
  			parameters.put(Environment.UNIQUE_RANDOM_PARAM, random);
  		} else {
  			// Remove step counter as not required for cached content
  			parameters.remove(Environment.STEP_VARIABLE);
  			parameters.remove(Environment.SESSION_TOKEN_VARIABLE);
  			// Add the cache key
  			parameters.put(Environment.CONTENT_CACHE_KEY, getCacheKey());
  		}
  
  		// this variable needs to be set in the portlet environment.
  		String url = env.getWServletPath();
  
  		return WebUtilities.getPath(url, parameters, true);
  	}
docs: Creates a dynamic URL that the image can be loaded from. In fact the URL points to the main application servlet,
  but includes a non-null for the parameter associated with this WComponent (ie, its label). The handleRequest
  method below detects this when the browser requests the image
  
  @return the url to load the image from