public function add_image_page($imagestoredfile) {
        $imageinfo = $imagestoredfile->get_imageinfo();
        $imagecontent = $imagestoredfile->get_content();
        $this->currentpage++;
        $template = $this->importPage($this->currentpage);
        $size = $this->getTemplateSize($template);

        if ($imageinfo["width"] > $imageinfo["height"]) {
            if ($size['w'] < $size['h']) {
                $temp = $size['w'];
                $size['w'] = $size['h'];
                $size['h'] = $temp;
            }
            $orientation = 'L';
        } else if ($imageinfo["width"] < $imageinfo["height"]) {
            if ($size['w'] > $size['h']) {
                $temp = $size['w'];
                $size['w'] = $size['h'];
                $size['h'] = $temp;
            }
            $orientation = 'P';
        } else {
            $orientation = 'P';
        }
        $this->SetHeaderMargin(0);
        $this->SetFooterMargin(0);
        $this->SetMargins(0, 0, 0, true);
        $this->setPrintFooter(false);
        $this->setPrintHeader(false);

        $this->AddPage($orientation, $size);
        $this->SetAutoPageBreak(false, 0);
        $this->Image('@' . $imagecontent, 0, 0, $size['w'], $size['h'],
            '', '', '', false, null, '', false, false, 0);
    }