Restricting image uploads by dimensions |
RichTextEditor has the capability to allow or restrict uploading image files by dimensions.
You can set maximum allowed dimensions using the following methods:
Set maximum allowed dimensions by editing security policy file
The security policy file (default.config, admin.config and guest.config) can be found in the richtexteditor/config folder. In security policy file you can find the following code which defines maximum allowed image dimensions within RichTextEditor. You can modify this settings to meet your own requirements.
<security name="MaxImageWidth"">0</security><!-- A value of 0 (zero) means unlimited --> <security name="MaxImageHeight">100</security> </category>
Programmatically set maximum allowed dimensions
RichTextEditor provides a powerful method named Editor.SetSecurity that allows you programmatically manage the security settings.
$rte->SetSecurity("*", "*", "MaxImageWidth", "0"); $rte->SetSecurity("*", "*", "MaxImageHeight", "1000*");
Allow/Deny/Allow large image uploading
In security policy file you can find the security setting LargeImageMode. This setting defines exactly what will happen to the Images larger than the maximum dimensions set in the settings.
LargeImageMode setting has three values:
- allow - All Images larger than the maximum dimensions will be allowed when uploading.
- deny - All Images larger than the maximum dimensions will be rejected when uploading.
- resize - All Images larger than the maximum dimensions will be proportionally resized to fit within the maximum dimensions when uploading.
You can modify this settings to meet your own requirements.
<security name="LargeImageMode">deny</security>
Programmatically allow/deny/allow large image uploading
$rte->SetSecurity("*", "*", "LargeImageMode", "deny");
Send feedback about this topic to CuteSoft. © 2003 - 2012 CuteSoft Components Inc. All rights reserved.