<input type="radio" name="output" value="graph" checked/> drawn graph
                        <input type="radio" name="output" value="text"/> graphviz input
                </div>
+               <div>
+                       <span>Image type:</span>
+                       <input type="radio" name="image" value="svg" checked/> SVG
+                       <input type="radio" name="image" value="png"/> PNG
+               </div>
 
                <textarea id="graphDesc" rows="15" style="width:100%"></textarea>
                <div id="result" style="display:none">
                                const graphDesc = document.getElementById("graphDesc").value;
                                const mcdType = getRadioValue("mcd");
                                const outputType = getRadioValue("output");
-                               const er = new ErDiags(graphDesc, outputType);
+                               const imageType = getRadioValue("image");
+                               const er = new ErDiags(graphDesc, outputType, imageType);
                                er.drawMcd("mcd", mcdType);
                                er.drawMld("mld");
                                er.fillSql("sql");
 
 // ER diagram description parser
 class ErDiags
 {
-       constructor(description, output)
+       constructor(description, output, image)
        {
                this.entities = { };
                this.inheritances = [ ];
                this.tables = { };
                this.mcdParsing(description);
                this.mldParsing();
-               this.output = output;
-               if (output == "graph")
-               {
-                       // Cache SVG graphs returned by server (in addition to server cache = good perfs)
-                       this.mcdGraph = "";
-                       this.mldGraph = "";
-               }
-               this.sqlText = "";
+               this.output = output || "compact";
+               this.image = image || "svg";
        }
 
        static CARDINAL(symbol)
        // DRAWING + GET SQL FROM PARSING
        /////////////////////////////////
 
-       static AjaxGet(dotInput, callback)
-       {
-               let xhr = new XMLHttpRequest();
-               xhr.onreadystatechange = function() {
-                       if (this.readyState == 4 && this.status == 200)
-                               callback(this.responseText);
-               };
-               xhr.open("GET", "scripts/getGraphSvg.php?dot=" + encodeURIComponent(dotInput), true);
-               xhr.send();
-       }
-
        // "Modèle conceptuel des données". TODO: option for graph size
        // NOTE: randomizing helps to obtain better graphs (sometimes)
        drawMcd(id, mcdStyle) //mcdStyle: bubble, or compact
        {
                let element = document.getElementById(id);
                mcdStyle = mcdStyle || "compact";
-               if (!!this.mcdGraph)
-               {
-                       element.innerHTML = this.mcdGraph;
-                       return;
-               }
                // Build dot graph input
                let mcdDot = 'graph {\n';
                mcdDot += 'rankdir="LR";\n';
                        });
                });
                mcdDot += '}';
-               if (this.output == "graph")
-               {
-                       // Draw graph in element
-                       ErDiags.AjaxGet(mcdDot, graphSvg => {
-                               this.mcdGraph = graphSvg;
-                               element.innerHTML = graphSvg;
-                       });
-               }
+               if (this.output == "graph") //draw graph in element
+                       element.innerHTML = "<img src='scripts/getGraph_" + this.image + ".php?dot=" + encodeURIComponent(mcdDot) + "'/>";
                else //just show dot input
                        element.innerHTML = mcdDot.replace(/</g,"<").replace(/>/g,">");
        }
        drawMld(id)
        {
                let element = document.getElementById(id);
-               if (!!this.mldGraph)
-               {
-                       element.innerHTML = this.mcdGraph;
-                       return;
-               }
                // Build dot graph input (assuming foreign keys not already present...)
                let mldDot = 'graph {\n';
                mldDot += 'rankdir="LR";\n';
                mldDot += links + '\n';
                mldDot += '}';
                if (this.output == "graph")
-               {
-                       ErDiags.AjaxGet(mldDot, graphSvg => {
-                               this.mldGraph = graphSvg;
-                               element.innerHTML = graphSvg;
-                       });
-               }
+                       element.innerHTML = "<img src='scripts/getGraph_" + this.image + ".php?dot=" + encodeURIComponent(mldDot) + "'/>";
                else
                        element.innerHTML = mldDot.replace(/</g,"<").replace(/>/g,">");
        }