Hi Cristian,
You're right. Only the user that saved the file can see it on the config. I'll give a try to fix this.
Thanks
Hi Cristian,
You're right. Only the user that saved the file can see it on the config. I'll give a try to fix this.
Thanks
Hi,
I am trying to create a new course format and add a header image for a course if the format selected is the new format. I followed all the steps to store the header image. The header image is getting stored as a int in the table mdl_course_format_options as name 'headerimage' and value '295861144'.
However, I am unable to display the saved image in the course page.
I try to output the file with a format as below to start with.
echo "<img src='".$CFG->wwwroot."/pluginfile.php/".$context->id."/format_enhancedtimeline/headerimage/295861144/2_enhamcedtimeline_banner.png'>";But the image displays is broken. I am unable to spot the error. Please help.
Thanks in advance.
Is it as simple as a typo in your code
echo "<img src='".$CFG->wwwroot."/pluginfile.php/".$context->id."/format_enhancedtimeline/headerimage/295861144/2_enhamcedtimeline_banner.png'>";enhancedtimeline and enhamcedtimeline?
Hi,
Thanks for the response.
It was not a typo. I figured out the way to get the file displayed forming the correct url.
I am facing a different issue now. I would like to restrict the number of file uploads to 1 and accepted types as jpg or png or gif.
$options = array(
'maxfiles' => 1,
'maxbytes' => $CFG->maxbytes,
'subdirs' => 0,
'accepted_types' => array('.jpg','.gif','.png')
);
'headerimage' => array(But this is not working. Any help please.
'label' => new lang_string('headerimage','format_timeline'),
'element_type' => 'filemanager',
'element_attributes' => array(
),
'options' => $options,
'help' => 'headerimage',
'help_component' => 'format_timeline',
)
Thanks,
Saran
Hey Saran,
Try to make your 'element_attributes' variable to look like this:
'headerimage' => array( 'label' => new lang_string('headerimage','format_timeline'), 'element_type' => 'filemanager', 'element_attributes' => array(null, array( 'subdirs' => 0, 'maxfiles' => 1, 'accepted_types' => array('.jpg', '.gif', '.png') )), 'help' => 'headerimage', 'help_component' => 'format_timeline', )
And remove the 'options' variable.
Thanks a lot Cristian !!! Worked like a charm