private function serializeImage(GraphicQuestion $graphicQuestion)
    {
        $questionImg = $graphicQuestion->getImage();

        $image = [];

        if ($questionImg) { // to handle old questions which may have no image
            $image['id'] = $questionImg->getUuid();
            $image['type'] = $questionImg->getType();

            if (0 === strpos($questionImg->getUrl(), './')) {
                // the way URLs were written previously isn't spec compliant
                $image['url'] = substr($questionImg->getUrl(), 2);
            } else {
                $image['url'] = $questionImg->getUrl();
            }

            $image['width'] = $questionImg->getWidth();
            $image['height'] = $questionImg->getHeight();
        }

        return $image;
    }