public function resize_image($width, $height) {
        global $CFG;
        require_once($CFG->libdir . '/gdlib.php');

        $content = $this->get_content();

        // Fetch the image information for this image.
        $imageinfo = @getimagesizefromstring($content);
        if (empty($imageinfo)) {
            return false;
        }

        // Create a new image from the file.
        $original = @imagecreatefromstring($content);

        // Generate the resized image.
        return resize_image_from_image($original, $imageinfo, $width, $height);
    }