Skip to content

Commit

Permalink
code addition
Browse files Browse the repository at this point in the history
  • Loading branch information
Darko Miletic committed Jan 25, 2018
1 parent 31dd6fd commit b3a347b
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,21 @@
}
}

// Another way to directly access file.
$filepath = get_config('local_fooplug', 'myimage');
if ($filepath) {
$file = $fs->get_file($PAGE->context->id, 'local_fooplug', 'filearea', 0, dirname($filepath), basename($filepath));
if ($file) {
$url = moodle_url::make_pluginfile_url(
$file->get_contextid(),
$file->get_component(),
$file->get_filearea(),
$file->get_itemid(),
$file->get_filepath(),
$file->get_filename()
);
echo html_writer::img($url->out(false), 'This is my image!!!');
}
}

echo $OUTPUT->footer();

0 comments on commit b3a347b

Please sign in to comment.