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

Media/Flash Manager default size issue

8 Answers 63 Views
Editor
This is a migrated thread and some comments may be shown as answers.
lan
Top achievements
Rank 1
lan asked on 25 Oct 2010, 09:51 PM
Hi Telerik team,

In our application, we allow user insert media. One thing is very confuse for our clients is the default size for the media file ( 150 * 150 ). Is there have any way we can use orignal video size unless the user really want to change it?

Best regards,

8 Answers, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 26 Oct 2010, 09:03 AM
Hi lan,

You can see how to modify the built-in RadEditor's dialogs in this live demo: Customize Built-in Dialogs.
The file that you should edit is named \EditorDialogs\MediaManager.ascx and is available in the RadControls for ASP.NET AJAX installation.

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
lan
Top achievements
Rank 1
answered on 26 Oct 2010, 03:12 PM
Hi Rumen,

Thanks for your reply. 

I know I should change the MediaManager.ascx file, but I don't know how. The point is I want to default size is my video file's orignal size instead of fixed value.

There have a function : populateObjectProperties: function(selectedObject). In this function, the _mediaWidth and _mediaHeight can be set by the selectedObject, looks like this is the method I should use. I didn't find this method to be called.

Please help me out here.

Thanks,
0
Rumen
Telerik team
answered on 27 Oct 2010, 11:52 AM
Hi lan,

I was able to render the inserted video with its default size by stripping the width and height attributes of the object tag. Here is an example:

<script type="text/javascript">
 
    function changeImageManager(editor, args) {
 
        if (args.get_commandName() == "MediaManager") {
             
            var callbackFunction = function (sender, args) {
 
                var result = args.get_value();
                var div = document.createElement("DIV");
                div.innerHTML = result;
                 
                div.firstChild.removeAttribute("width");
                div.firstChild.removeAttribute("height")
                editor.pasteHtml(div.innerHTML);
            };
            args.set_callbackFunction(callbackFunction);
        }
    }   
</script>
<telerik:RadEditor runat="server" ID="RadEditor1" OnClientCommandExecuting="changeImageManager">
    <MediaManager ViewPaths="~/Documents" UploadPaths="~/Documents" />
</telerik:RadEditor>

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
lan
Top achievements
Rank 1
answered on 27 Oct 2010, 04:32 PM
Hi Rumen,

I have tested your function, as far as I can understand, it works as following :

When I open the Media manager, the default width is 150 and default height is 150. I click insert, the script you provide will remove the default width and default height attributes from the video object. By this way, the default width and height are useless.

Can we do something like these:

1. by default, the default width / height are empty ( or set as video orignal width/height ). When the user click insert, the video size equals to it's original size

2. user can reset the default width / height by changing the default width / height input textbox. When user click insert, the video size equals to the size which inputted by the user.

Thanks,
Lan
0
Rumen
Telerik team
answered on 28 Oct 2010, 10:52 AM
Hello lan,

For your convenience I implemented the required feature and attached my project.

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
lan
Top achievements
Rank 1
answered on 28 Oct 2010, 04:26 PM
Hi Rumen,

Thanks for your reply.

I tried all your files and I find the result is :

1. if I set the default width/height in the media manager, the result is good
2. if I don't set the default width/height ( they are empty ), the media manager will insert an object with width = "1" height = "1".

See following ( copy it from editor HTML mode )

<embed width="1" height="1" pluginspage="http://www.apple.com/quicktime/download/" type="movie/quicktime" URL="/Test/FlickAnimation.avi" altHtml="&lt;rade_param name=&quot;URL&quot; value=&quot;/Test/FlickAnimation.avi&quot;&gt;&lt;embed src=&quot;/Test/FlickAnimation.avi&quot; originalAttribute=&quot;src&quot; originalPath=&quot;/Test/FlickAnimation.avi&quot; originalAttribute=&quot;src&quot; originalPath=&quot;/Test/FlickAnimation.avi&quot; width=&quot;0&quot; height=&quot;0&quot; type=&quot;application/x-mplayer2&quot; pluginspage=&quot;http://www.microsoft.com/Windows/MediaPlayer&quot;&gt;&lt;/embed&gt;" />

I have compared the files you provide. The MediaManager.ascx is the only file got changed. I saw you changed the following functions:

_getParams,

_getObjectAttributes

_setInitialValues

You set this._mediaWidth.value and this._mediaHeight.value in thoese functions.

Did I miss something because I didn't see the feature work for our application?

Thanks,
Lan

 

0
Accepted
Rumen
Telerik team
answered on 01 Nov 2010, 03:31 PM
Hi lan,

Did you see the change in the OnClientPasteHtml function? The highlighted line below strips the width and height attributes if their values are 0 and 1:

<script type="text/javascript">
 
    function changeImageManager(editor, args) {
 
        if (args.get_commandName() == "MediaManager") {
 
            var callbackFunction = function (sender, args) {
                var result = args.get_value();
                result = result.replace(/[width|height]=\"[10]?\"/gi, ""); //.replace(/width=\"1\"/gi, "").replace(/height=\"1\"/gi, "");
                editor.pasteHtml(result);
            };
            args.set_callbackFunction(callbackFunction);
        }
    }   
</script>
<telerik:RadEditor runat="server" ID="RadEditor1" ExternalDialogsPath="~/EditorDialogs" OnClientCommandExecuting="changeImageManager">
    <MediaManager ViewPaths="~/Documents" UploadPaths="~/Documents" />
    <ImageManager ViewPaths="~/Documents" UploadPaths="~/Documents" />
</telerik:RadEditor>



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
lan
Top achievements
Rank 1
answered on 01 Nov 2010, 03:58 PM
It works.

Thank you Rumen!
Tags
Editor
Asked by
lan
Top achievements
Rank 1
Answers by
Rumen
Telerik team
lan
Top achievements
Rank 1
Share this question
or