Get the course image if added to course.

@param object $course
@return string url of course image
503745
public static function get_course_image($course) {
        global $CFG;
        $courseinlist = new \core_course_list_element($course);
        foreach ($courseinlist->get_course_overviewfiles() as $file) {
            if ($file->is_valid_image()) {
                $pathcomponents = [
                    '/pluginfile.php',
                    $file->get_contextid(),
                    $file->get_component(),
                    $file->get_filearea() . $file->get_filepath() . $file->get_filename()
                ];
                $path = implode('/', $pathcomponents);
                return (new moodle_url($path))->out();
            }
        }
        return false;
    }
33050
public static function getImageList() {
        if (self::$_image) {
            return self::$_image;
        }

        self::$_image = self::_getList('image');

        return self::$_image;
    }
321846
function fetchImageURL()
    {

        $imageNode =  $this->attribute( 'image_node' );
        if ( !$imageNode )
            return false;

        $imageObject =  $imageNode->attribute( 'object' );
        if ( !$imageObject )
            return false;

        $dataMap =  $imageObject->attribute( 'data_map' );
        if ( !$dataMap )
            return false;

        $imageAttribute =  $dataMap['image'];
        if ( !$imageAttribute )
            return false;

        $imageHandler =  $imageAttribute->attribute( 'content' );
        if ( !$imageHandler )
            return false;

        $imageAlias =  $imageHandler->imageAlias( 'rss' );
        if( !$imageAlias )
            return false;

        $url = eZSys::hostname() . eZSys::wwwDir() .'/'. $imageAlias['url'];
        $url = preg_replace( "#^(//)#", "/", $url );

        return 'http://'.$url;
    }
1114453
public function getImageUrl($imageModulePath)
    {
        /** @var \Magento\Framework\App\ObjectManager $om */
	$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
	/** @var \Magento\Framework\View\Asset\Repository */
	$viewRepository = $objectManager->get('\Magento\Framework\View\Asset\Repository');
	return $viewRepository->getUrl($imageModulePath);
    }
1012031
public function getClass($classname)
    {
        if ((string) $classname == '' || !array_key_exists($classname, $this->classes)) {
            throw new ImageClassNotRegisteredException($classname);
        }
        return $this->classes[$classname];
    }
962838
public function getUrlAttribute($suffix = '')
    {
        if (!$this->exists) {
            return Cache::rememberForever('missing_photo', function () {
                return static::placeholder('No photo provided');
            });
        }

        if (!$this->processed) {
            return Cache::rememberForever('processing_photo', function () {
                return static::placeholder(
                    "This photo is\nbeing processed\nand will appear\nshortly"
                );
            });
        }

        return "/photo/{$this->photoId}$suffix.jpg";
    }
408939
public function image($id, $class = '')
    {
        $img = '';

        if ($image = app('Grafite\Cms\Models\Image')->find($id)) {
            $img = $image->url;
        }

        return '<img class="'.$class.'" src="'.$img.'">';
    }
993665
protected function getImageUrlOrDefault()
    {
        $file = '';

        if (is_object($this->entity->image)) {
            $file = $this->entity->image->path;
        }

        if (!Storage::exists($file)) {
            $file = $this->imgNotFound();
        }

        return Storage::url($file);
    }
416511
public function get_course_formatted_name($course, $options = array()) {
        $options = (array)$options;
        if (!isset($options['context'])) {
            $options['context'] = context_course::instance($course->id);
        }
        $name = format_string(get_course_display_name_for_list($course), true, $options);
        if (!empty($this->searchcriteria['search'])) {
            $name = highlight($this->searchcriteria['search'], $name);
        }
        return $name;
    }
795150
public function get_img_url( $path, $default = 'img/no_img.png', $append_version = true ) {
		return empty( $path ) ? '' : $this->get_assets_url( 'img/' . $path, $default, $append_version );
	}
156752
public static function getClass($type)
    {
        if (!static::isAvailable($type)) {
            throw new \Exception(
                "Invalid image format '{$type}'. " .
                "Allowed formats are: " . implode(', ', static::available())
            );
        }

        $className = static::$typesMap[strtolower($type)];

        return new $className();
    }
1309149
public function get_courserecord() {
        global $DB;

        if ($this->courserecord == null) {
            $this->courserecord = $DB->get_record('course', array('id' => $this->properties->course));
        }
        return $this->courserecord;
    }
998282
public function getImagesUrl() {
        $url = sprintf($this->getBaseUrl() . '/users/%s/images.json', $this->getUser());

        return Http\ImagesUrl::factory(
            $url,
            $this->getConfig('privateKey'),
            $this->getPublicKey()
        );
    }
614455
protected function getImageUrl(ImagePathInterface $path) {
	    $url = $path->getPath();
	    if ($this->getOption('use_prefix', false)) {
	        $url = rtrim($path->getPrefix(), '/') . '/' . $url;
	    }
	    if ($this->getOption('root_url')) {
	        $url = rtrim($this->getOption('root_url'), '/') . '/' . $url;
	    }
	    return filter_var($url, FILTER_SANITIZE_URL);
	}
47213
public function &GetImageSizeObject()
    {
        if (is_null($this->oImageSize)) {
            $this->oImageSize = TdbShopArticleImageSize::GetNewInstance();
            if (!$this->oImageSize->Load($this->sqlData['shop_article_image_size_id'])) {
                $this->oImageSize = null;
            }
        }

        return $this->oImageSize;
    }
259646
public function get($key) {
        if ($key != 'course') {
            return parent::get($key);
        }
        global $DB;
        if (empty($this->course)) {
            $this->course = $DB->get_record('course', array('id' => $this->cm->course));
        }
        return $this->course;
    }
868018
public function getInfo()
    {
        preg_match('~//([^ ]+)\.didacte\.com/a/course/~i', $this->url, $m);
        $this->apiUrl = str_replace('{m}', $m['1'], $this->apiUrl);
        return parent::getInfo();
    }