/** * {@inheritDoc} */ protected function normalize() { parent::normalize(); $val = $this->base['value']; if ($val) { switch ($this->base['return_format']) { case 'array': $this->atWidth = $val['width']; $this->atHeight = $val['height']; break; case 'id': $src = wp_get_attachment_image_src($this->id(), 'full'); $this->atWidth = $src[1]; $this->atHeight = $src[2]; break; case 'url': $this->atWidth = 0; $this->atHeight = 0; break; default: throw new Exception("Field format {$this->base['return_format']} not valid"); } } else { $this->atWidth = 0; $this->atHeight = 0; } }