How can i set a limit only for the images uploaded in course/edit.php in moodle?

How can i set a limit only for the images uploaded in course/edit.php in moodle?

by Catalin Baron Damaschin -
Number of replies: 4

Hello Moodle dev,

I have this request from a Moodle platform user manager:

How can i set a limit only for the images uploaded in course/edit.php in Moodle? So that the thumbnails for the courses can load faster?

I know that an auto size function exist but users don't use it and upload very large images sometimes. 

Thank you!

Average of ratings: -
In reply to Catalin Baron Damaschin

Re: How can i set a limit only for the images uploaded in course/edit.php in moodle?

by Catalin Baron Damaschin -
For anyone interested you should investigate the Atto editor plugin.
https://docs.moodle.org/dev/Atto
In reply to Catalin Baron Damaschin

Re: How can i set a limit only for the images uploaded in course/edit.php in moodle?

by Michael Milette -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
Hi Retete,

Did you find a solution to your question? If so, any chance you could share it?

Michael
In reply to Michael Milette

Re: How can i set a limit only for the images uploaded in course/edit.php in moodle?

by Catalin Baron Damaschin -
Hello Michael,

I have found that Atto editor icons are mini plugins. You can find this structure in: lib/editor/atto/plugins/.
I tried to set a limit on the image plugin lib/edior/atto/plugins/image/yui/src/js/button.js

 function image.onload = function() 
 on the variables currentwidth and currentheight 

It doesn't work, I am trying to better understand the code from the button.js file.

 I get this far smile
Catalin Baron Damaschin



In reply to Catalin Baron Damaschin

Re: How can i set a limit only for the images uploaded in course/edit.php in moodle?

by Catalin Baron Damaschin -
My approach is to develop a new modular plugin with upload and resize image functionality. This plugin can be linked to an Atto editor icon with the desired function attached. The plugin can be written in javascript code which is the base language for the Atto editor.