使用完整日历在网站上获取并显示来自Google日历事件的附加图像

get and display attached image from google calendar event on website with fullcalendar

本文关键字:日历 Google 事件 显示 图像 网站 获取      更新时间:2023-09-26

我已经从谷歌日历中导入了事件,在我的网站上使用了完整的日历。我需要在单击日历事件时在弹出窗口中显示来自谷歌日历的附加图像文件。我尝试从事件对象获取图像,如下所示$j('#test-img').html(event.attachment[0].fileUrl);但在单击时,我已重定向到谷歌事件详细信息页面。通常会显示其他事件信息。如何获得正确的图像网址?也许存在谷歌日历/完整日历功能来显示来自谷歌日历的附加 img 文件。

    $j('#calendar').fullCalendar({
        googleCalendarApiKey: 'AIzaSyCD7ju2cVMfoM-yLL5IsH3fG9SDUOexjH0',
        events:'jetme6103iige9dqvd7pejpt34@group.calendar.google.com',
        firstDay: 1,
        timeFormat: 'MMMM',
        height: "auto",
        eventClick: function(event) {
            PopUpShow();
            $j('#title').html(event.title);
            $j('#start').html(moment(event.start).format("DD MMMM YYYY"));
            $j('#test-desc').html(event.description);
            $j('#test-img').html(event.attachment[0].fileUrl);
            console.log(event);
            return false;
        },
        loading: function(bool) {
            $j('#loading').toggle(bool);
        },
        eventRender: function(event, element) {
            var dataToFind = moment(event.start).format('YYYY-MM-DD');
            $j("td[data-date='" + dataToFind + "']").addClass('activeDay');
        }
    });

我认为您无法通过 API 完成,您可以从日历 UI 附加事件,因为这是实验性功能。