General developer forum

 
 
Davo
Re: Showing pictures saved with filemanager
Group DevelopersGroup Particularly helpful Moodlers

$fs = get_file_storage();

$files = $fs->get_area_files(/* Insert file area details here */);

foreach ($files as $file) {

$imgurl = moodle_url::make_pluginfile_url($file->get_contextid(), $file->get_component(), $file->get_filearea(), $file->get_itemid(), $file->get_filepath(), $file->get_filename());

echo "<img src='{$imgurl}' />';

}

You'll also need to edit your plugins lib.php file and add a [pluginname]_pluginfile() function - see mod/forum/lib.php, function 'forum_pluginfile' for an example.

 
Average of ratings: -
Picture of Doncho Petrov
Re: Showing pictures saved with filemanager
 

It worked like a charm.

Thanks a lot! : )

 
Average of ratings: -