This assumes that the global for the current image $_zp_current_image is set:
`
$maxwidth = 300;
$maxheight = 180;
getMaxSpaceContainer($maxwidth, $maxheight, $_zp_current_image);
$url = $_zp_current_image->getCustomImage(NULL, $maxwidth, $maxheight, NULL, NULL, NULL, NULL, NULL, NULL);
`