This is a migrated thread and some comments may be shown as answers.

ImageEditor Save As Filename

6 Answers 116 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Unified Development
Top achievements
Rank 1
Unified Development asked on 13 May 2010, 10:51 PM
I am using the Image Editor and an override of StoreBitmap().
Is there a way to find out the original name of the image being edited?
I don't care about what the user would type into the "Save As" box.
Is there also a way to hide or disable that box?

6 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 14 May 2010, 01:49 PM
Hi Derek,

You can get the file name including the suffix _thumb (ImageName_thumb) from the second URL parameter of the StoreBitmap method

public override string StoreBitmap(System.Drawing.Bitmap bitmap, string url, System.Drawing.Imaging.ImageFormat format)
{
    return base.StoreBitmap(bitmap, url, format);
}


After that you can replace the suffix with an empty string using String.Replace and get the original image name.

To hide the Save As field, register the external dialogs of RadEditor and modify the content of the ImageEditor.ascx file. You can find more information in this live demo: Customize Built-in Dialogs.

Greetings,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Unified Development
Top achievements
Rank 1
answered on 14 May 2010, 03:20 PM
The user is able to type anything they want into the "Save As" box however.
If they changed it, I would not have the original filename.

For example, I chose to Edit "test.jpg" then I crop it and save as "cropped.jpg"
StoreBitmap() only knows about "Cropped.jpg", right?

How do find "test.jpg"?  Is that knowable?

I guess I'm basically looking for "Save" functionality, not "Save As".
0
Rumen
Telerik team
answered on 17 May 2010, 12:59 PM
Hi Derek,

From your initial post I got the impression that you plan to hide the "Save As" box in the Image Editor and I provided instructions how to do that, e.g.

1) Enable the external editor's dialogs
2) Open the EditorDialogs/ImageEditor.ascx file
3) Locate the <tr> element holding the Save As box and hide the whole <tr>, e.g.

<tr style="display:none;">
    <td>
        <input type="hidden" id="OriginalImageLocation" name="OriginalImageLocation" />
        <div style="padding: 4px 0">
            <label for="NewImageName">
                <script type="text/javascript">
                    document.write(localization["SaveAs"]);
                </script>
            </label><br />
            <input type="text" id="NewImageName" name="NewImageName" style="margin-left: 4px; width: 260px;" /><span id="NewImageExt">&nbsp;</span>
        </div>
    </td>
</tr>

4) Save the ImageEditor.ascx file.

After hiding this box the user will be unable to change the image name and you can easily strip the _thumb suffix.

I hope this helps.

Best regards,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Unified Development
Top achievements
Rank 1
answered on 18 May 2010, 06:30 PM
Am I able to write CSS to modfiy the style of the text box? It's ID is "NewImageName"
but where would I put css code for it to pick it up?
or how can I link in a .css file for the ImageEditorDialog?
 
0
Accepted
Rumen
Telerik team
answered on 19 May 2010, 02:05 PM
Hi Derek,

You can either put an ID selector class (#NewImageName) inside style tags in the ImagEditor.ascx file or import an external css file with this class in all editor's dialogs through the DialogsCssFile of RadEditor.

Best regards,
Rumen
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Unified Development
Top achievements
Rank 1
answered on 19 May 2010, 05:22 PM
In my aspx page, I was able to add the DialogsCssFile attribute to telerik:dialogopener tag and it worked great. thanks!
Tags
Editor
Asked by
Unified Development
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Unified Development
Top achievements
Rank 1
Share this question
or