google-code-export / mathmleditor

Automatically exported from code.google.com/p/mathmleditor
1 stars 1 forks source link

Error Saving Image on Server #96

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

I think the path...

What is the expected output? What do you see instead?

image should be inserted inside ckeditor on windows server

What version of the product are you using? On what browser?
v2.2 on chrome and mozilla browser

Please provide any additional information below.
the same code is running on local but not on server....plz help me with the 
solution

Original issue reported on code.google.com by sahoo6...@gmail.com on 9 Jan 2014 at 7:47

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,
First step: The image is saved on the server ?
if no, FMath Editor is not configured. Your url is not good
<property id="urlGenerateImage">ckeditor/capture/ImageCapture.aspx</property>
if yes, what is the returned url ?

regards

Original comment by ionel.alexandru@gmail.com on 9 Jan 2014 at 8:56

GoogleCodeExporter commented 9 years ago
The returned url is mentioned in the attatched image.What is the issue i m not 
getting it?

Original comment by sahoo6...@gmail.com on 10 Jan 2014 at 3:20

Attachments:

GoogleCodeExporter commented 9 years ago
hmm, this is not the returned url
This is an exception when flash try to save the image on the server.
http://test.imentrance.com/ckeditor/capture/ImageCapture.aspx is ok?

if yes, open the code to understand what is doing.
You need to have a folder for image, ...

Original comment by ionel.alexandru@gmail.com on 10 Jan 2014 at 5:40

GoogleCodeExporter commented 9 years ago
I have the Folder img for images inside Capture Folder.

My Code is as mentioned below see my code and help me out of this stuck:
var image = Request.Params["image"];
        if (string.IsNullOrEmpty(image)) return;

        var imageContent = Convert.FromBase64String(image);
        if (imageContent == null) return;

        var save = Request.Params["save"];
        var name = Request.Params["name"];
        var type = Request.Params["type"];
        if (!string.IsNullOrEmpty(save) &&
            !string.IsNullOrEmpty(name) &&
            (string.Compare(type, "JPG", true) == 0 || string.Compare(type, "PNG", true) == 0))
        {
            var webappRoot = Server.MapPath("img/");
            var fileName = webappRoot + name + "." + type;
            using (var outputStream = new BinaryWriter(File.Open(fileName, FileMode.Create)))
            {
                outputStream.Write(imageContent);
                outputStream.Flush();
            }

            Response.ClearContent();
            string cFileName = @"/ckeditor/capture/img/" + name + "." + type;
            Response.Write(cFileName);
            Response.End();
        }
        else
        {
            Response.ContentType = "image/jpeg";
            using (var os = Response.OutputStream)
            {
                for (int i = 0; i < imageContent.Length; i++)
                    os.WriteByte(imageContent[i]);

                os.Flush();
                os.Close();
            }
        }

Original comment by sahoo6...@gmail.com on 11 Jan 2014 at 6:12