social-media 相关问题


有没有办法在 Facebook 上分享 React 页面并传递图像?

我正在尝试让我的 React 页面可在 Facebook 和 Twitter 上共享。 我尽了一切努力,我整天都在谷歌上搜索,但找不到答案。 我正在尝试让我的 React 页面可以在 Facebook 和 Twitter 上共享。 我尽了一切努力,我整天都在谷歌上搜索,但找不到答案。 <FacebookShareButton url={window.location.href} title={exactNews.text ?exactNews.title : ""}> <FaFacebookF/> </FacebookShareButton> 有什么建议吗? 无法再将图像传递到共享选项,将图像添加到共享 URL 的唯一方法是使用源中的 og:image 标签。请注意,Facebook 忽略 JavaScript,因此 og:image 标签必须位于原始源中,而不是通过 JavaScript 动态添加。然后,Facebook 会自动使用 og:image 标签中指定的图像。 更多信息:https://ogp.me/ 您可以使用 https://prerender.io/benefits/social-media-sharing/ 或 Next.js 等框架使用正确的 OG 图像在服务器端渲染页面。


Microsoft Media Foundation - 解码 h264 样本

我使用 Microsoft Media Foundation 示例(即 MFCaptureToFile)从网络摄像头捕获 H264 帧并将其写入文件。 我正在尝试使用 IMFTransform 来解码捕获的帧...


如何使用jetpack在Exoplayer和media 3中添加自定义ui控制器,就像android中的旧视图系统一样?

我正在将 Exoplayer 与 Media 3 库一起使用。我无法像我们在旧视图系统中那样在 Exoplayer 中添加自定义句柄。 我期望添加自定义 UI,其控制器与旧版本相同......


Maven-shade-plugin 检测到某些类文件存在于两个或多个 JAR 中

我正在尝试使用 maven-shade-plugin,但收到警告: javafx-controls-18.0.1-win.jar,javafx-graphics-18.0.1-win.jar, javafx-media-18.0.1-win.jar、javafx-web-18.0.1-win.jar 定义 1 覆盖...


如何使用 asyncio 连续监控 telnetlib3 连接以从主机端终止

我正在使用 telnetlib3 和 asyncio 模块在 Python 3 中创建一个 telnet 客户端。更具体地说,telnet 客户端是与 VLC Media Player 的 telnet 接口连接的。我有蜜蜂...


删除手机完美滚动条

我只是将完美滚动条类“高度:自动”放在移动屏幕上,应该可以工作。 因为它在网络上的响应模式下工作正常。 但在手机上它没有滚动。 @media(最大无线...


如何使用 Oracle Cloud Bucket 系统配置 Wordpress Media Cloud 插件

尽管我是一名经验丰富的前端开发人员,但我对 DevOps 和云基础设施的含义还算不上菜鸟。 太棒了; 我不知道如何填写必要的值来集成媒体云世界...


如何防止图片被下载到手机上?

假设这个标记: 假设这个标记: <picture> <source media="(max-width: 767px)" srcset="//placehold.it/350x150&text=Up+to+767" /> <source media="(max-width: 991px)" srcset="//placehold.it/350x150&text=Up+to+991" /> <img src="//placehold.it/570x200&text=Desktop+image" class="responsive-image" /> </picture> 是否可以在不使用 JavaScript 的情况下防止在小型设备上下载“最多 767”图像?虽然以下CSS将隐藏图像,并且似乎已经在视觉上解决了问题: @media (max-width: 767px) { .responsive-image { display: none; } } 它仍然会下载图像,这是我想避免的。我希望我可以简单地为我想要隐藏的图像提供一个空的 srcset 属性,但随后会加载下一个图像。 小提琴:https://jsfiddle.net/n68ousqu/ 我没有足够的声誉点来评论@MiscellaneousUser,但看来,至少在 Chrome 中,您可以从我原来的帖子中获取 HTML 和 CSS,然后只需将 loading="lazy" 添加到 img 元素即可获得这个工作。


即使 Spring Boot 项目的 html 页面上的路径正确,svg 文件也无法打开

我打算在我的 Spring Boot thymeleaf 项目中使用 Metronic html 登录页面,所以我更新了代码以导入资产。 我打算在我的 Spring Boot thymeleaf 项目中使用 Metronic html 登录页面,所以我更新了代码以导入资产。 <link th:href="@{/uploads/assets/plugins/global/plugins.bundle.css}" rel="stylesheet" type="text/css" /> <link th:href="@{/uploads/assets/css/style.bundle.css}" rel="stylesheet" type="text/css" /> css 文件已加载并应用到页面上,但 svg 文件未打开。我只能将替代“徽标”视为文本。 <!-- doesn't work --> <a href="/index.html" class="mb-7"> <img alt="Logo" th:src="@{/uploads/assets/media/logos/logo.svg}" /> </a> 如果我将 png 文件放在同一路径中,那么它就可以工作 <a href="/index.html" class="mb-7"> <img alt="Logo" th:src="@{/uploads/assets/media/logos/logo.png}" /> </a> 请帮我找出这个原因 登录页面实际上有4个svg文件,但都打不开。 关于我的项目 主题 svg 文件有效


将 2 个弹性列合并为 1 个交替的子列

我有一个有 2 列的弹性容器。 每列也是一个弹性容器,里面有许多盒子。 我有一个 flex 容器,有 2 列。 每列也是一个弹性容器,里面有许多盒子。 <div class="flex-container"> <div class="column left-column"> <div class="box boxA">Box A</div> <div class="box boxB">Box B</div> </div> <div class="column right-column"> <div class="box boxC">Box C</div> <div class="box boxD">Box D</div> <div class="box boxE">Box E</div> </div> </div> 我希望在移动视图中,2 列变成 1。 现在,我通过将 flex-direction: column 添加到 flex-container 来实现这一点,这使得 2 列彼此重叠(垂直,而不是 z 轴)。 .flex-container { display: flex; gap: 10px; padding: 10px; max-width: 800px; } .column { display: flex; flex-direction: column; flex: 1; gap: 10px; } .left-column { flex: 2; } .right-column { flex: 1; } .box { border: 1px solid lightgrey; border-radius: 8px; padding: 8px; } @media (max-width: 800px) { .flex-container { flex-direction: column; } } 但现在我还需要重新排列框的顺序,以便在移动视图中显示为 A、C、D、E、B。 我认为仅使用 CSS 无法实现这一点,因为它需要“破坏”弹性列。 这是我目前拥有的沙箱:https://codepen.io/marcysutton/pen/ZYqjPj 顺便说一句,这是在 React 应用程序中,所以我可能必须以编程方式重新排列框。 如果可能的话,我只是更喜欢使用 CSS 来做到这一点。 在下部宽度处使用 display: contents“破坏”包装 div,然后在 order 上使用 .boxB。 .flex-container { display: flex; gap: 10px; padding: 10px; max-width: 800px; } .column { display: flex; flex-direction: column; flex: 1; gap: 10px; } .left-column { flex: 2; } .right-column { flex: 1; } .box { border: 1px solid lightgrey; border-radius: 8px; padding: 8px; } @media (max-width: 800px) { .flex-container { flex-direction: column; } .column { display: contents; } .boxB { order: 2; } } <div class="flex-container"> <div class="column left-column"> <div class="box boxA">Box A</div> <div class="box boxB">Box B</div> </div> <div class="column right-column"> <div class="box boxC">Box C</div> <div class="box boxD">Box D</div> <div class="box boxE">Box E</div> </div> </div>


似乎无法让下载属性发挥作用

我刚刚开始学习 html 所以我想尝试使用 download 属性 我刚刚开始学习 html,所以我想尝试使用下载属性 <a href="../images/clunk.jfif" download="ur_mum"> <img src="../images/clunk.jfif" alt="ur mum" width="200" height="200"> </a> 图像存储在同一个网站上,但是当我单击它而不是下载时,它只会使图像全屏显示。 我尝试尽可能地排除故障,但没有成功 我能找到的关于为什么某些文件类型发生这种情况但并非所有文件类型的原因是这个答案关于pdf下载与预览的类似问题 - 如果可以的话,请将以下标头添加到服务器端的图像响应中: Content-Disposition: attachment; filename=clunk.jfif 或者,您可以使用自定义 onclick 处理程序替换锚标记,该处理程序将图像转换为数据 URL 并触发下载: <img src="../images/clunk.jfif" width="200" height="200" onclick="downloadImage(this)"> const downloadImage = async (img) => { // fetch the image's media type const mediaType = fetch(img.currentSrc, { method: 'HEAD' }) .then(res => res.headers.get('content-type')) .catch(() => 'image/png' /* default to png if request fails */) // place the image on a canvas element const canv = Object.assign(document.createElement('canvas'), { width: img.naturalWidth, height: img.naturalHeight, }) const ctx = canv.getContext('2d') ctx.drawImage(img, 0, 0) // download the canvas data const a = Object.assign(document.createElement('a'), { download: 'filename', href: canv.toDataURL(await mediaType), }) a.click() }


如何在 C++/WinRT (WinUI3) 中将图像从内存读取到 ImageSource?

[1] 我想在 XAML 中显示 Image 控件的图像,但该图像来自字节数组。 我应该怎么办?图像格式可以是JPG、BMP或PNG之一。 [1] 我想在 XAML 中显示 Image 控件的图像,但该图像来自字节数组。 我该怎么办?图像格式可以是 JPG、BMP 或 PNG 之一。 <Image x:Name="img"/> void MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&) { unsigned long long size; // iamge data size const unsigned char* buf; // image data img().Source(???); // what should I do? } [2] 我尝试了InMemoryRandomAccessStream,但没有成功。 我知道在C#中使用MemoryStream很方便,但是如何在C++中实现它? 另一个问题是这个方法是否也适用于JPG和PNG格式的图像? void MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&) { unsigned long long size; // iamge data size const unsigned char* buf; // image data winrt::Microsoft::UI::Xaml::Media::Imaging::BitmapImage bmp; winrt::Windows::Storage::Streams::InMemoryRandomAccessStream stream; // How to read data from stream? bmp.SetSource(stream); img().Source(bmp); } [3] 现在功能已经实现了,但是还有两个问题 IAsyncAction MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&) { unsigned long long size; // iamge data size const unsigned char* buf; // image data winrt::Microsoft::UI::Xaml::Media::Imaging::BitmapImage bmp; winrt::Windows::Storage::Streams::InMemoryRandomAccessStream stream; winrt::Windows::Storage::Streams::DataWriter dw(st.GetOutputStreamAt(0ULL)); dw.WriteBytes({ buf, size }); // This is very inefficient! co_await dw.StoreAsync(); dw.Close(); bmp.SetSource(stream); img().Source(bmp); stream.Close(); } 首先,我发现DataWriter::WriteBytes()确实是在复制数据。但我认为ImageSource只需要从我的buf中读取即可,不需要在读取之前将整个图像完全复制到流中。也许是类似MemoryView的东西,我这样想是不是错了? 其次,DataWriter和InMemoryRandomAccessStream的Close()应该在哪里调用? BitmapImage需要释放内存吗?这里有一个异步函数,我不知道应该写在哪里 [4] 根据IInspectable,我尝试了SHCreatMemStream并搜索了大量信息以提出另一个解决方案。目前的问题是,与方法[3]同样可行,但仍然会出现内存分配问题。 #include "Shlwapi.h" #include "shcore.h" #pragma comment(lib, "shlwapi.lib") void MainWindow::myButton_Click(IInspectable const&, RoutedEventArgs const&) { unsigned long long size; // iamge data size const unsigned char* buf; // image data winrt::Microsoft::UI::Xaml::Media::Imaging::BitmapImage bmp; IStream* stream{ SHCreateMemStream(buf, size) }; // Copying takes a lot of time static const GUID guidIRandomAccessStream = { 0x905a0fe1, 0xbc53, 0x11df, { 0x8c, 0x49, 0x00, 0x1e, 0x4f, 0xc6, 0x86, 0xda } }; winrt::Windows::Storage::Streams::IRandomAccessStream pRas{ }; CreateRandomAccessStreamOverStream(stream, BSOS_OPTIONS::BSOS_DEFAULT, guidIRandomAccessStream, (void**)&pRas); bmp.SetSource(stream); img().Source(bmp); } 通过性能测试,发现CreateRandomAccessStreamOverStream的时间是一致的,但是SHCreateMemStream消耗的时间与图像大小成正比。可以得出,SHCreateMemStream中创建流的过程也涉及到内存的复制。 我对Windows编程中的Stream不是特别熟悉。创建流的过程一定会涉及到内存复制吗?从内存加载图像可以避免额外的开销吗?还有没有类似MemoryStreamView的结构来替代吗? 还有一个问题,我知道新的图像肯定需要内存存储。 BitmapImage设置Stream为Source会接管Stream占用的内存吗? Image控件设置BitmapImage作为Source会接管BitmapImage占用的内存吗? 如果是这样的话,我可以接受Stream分配新的内存,否则仍然是一个效率问题。 谢谢!!!!!!! 使用Stream已经彻底解决了这个问题。如前四期所述。 至于附加问题: ★1 使用 CreatStreamOnHGlobal 而不是 SHCreatMemStream。 因为SHCreatMemStream在调用过程中会对传入的内存块参数进行另一次内存复制。 CreatStreamOnHGlobal 创建流后不执行内存复制。您可以先通过GlobalAlloc分配内存,写入所需的图像数据,然后调用CreatStreamOnHGlobal,无需任何时间开销。另外,可以将CreatStreamOnHGlobal的第二个参数设置为true,自动释放GlobalAlloc分配的内存。 通过进程内存监控,我发现对于同一个程序,使用CreatStreamOnHGlobal的速度是SHCreatMemStream的两倍,并且不会导致内存泄漏。 ★2 创建的Stream需要调用Release方法减少一个引用。 IRandomAccessStream作为局部变量,会自动析构,无需主动释放。 并且BitmapImage还管理一部分引用,这些引用在离开作用域后被释放。 通过测试COM对象上Release方法的返回值,发现整个程序结束后引用计数又回到了0


如何让 MUI 的带有链接的按钮看起来像普通按钮?

我有一个按钮可以下载带有文件名的文件。为此,我写了这样的内容: 我有一个按钮可以下载带有文件名的文件。为此,我写了这个: <Button color='primary' href=`/apiproxy/objects/${id}/subobjects` LinkComponent={React.forwardRef((props, ref) => <Link {...props} type='text/csv' download={`object_${id}_subobjects.csv`} ref={ref} />)} /> 生成的元素看起来与我的其他没有 href 属性的按钮相同(也带有 color='primary'),但悬停时其文本颜色更改为蓝色,与其他按钮不同,它保持白色。 如何使其样式与其他按钮相同?我可以将 &:hover 文本颜色指定为白色,但是当主题更改其他按钮的文本颜色时,这会中断。 有没有办法更改链接组件,使其样式与其他按钮相同,或者如果没有,按钮在调色板中使用什么作为悬停文本颜色,以便我可以将其设置为该颜色? 我认为您可以使用 styledComponent 作为链接组件。就像下面... const theme = useTheme(); const StyledLink = styled(Link)(({ theme, color = "primary" }) => ({ ":hover": { color: theme.palette.secondary.main, }, })); <Button color="primary" href="/apiproxy/objects/1/subobjects" LinkComponent={React.forwardRef((props, ref) => ( <StyledLink {...props} type="text/csv" download={"object_1_subobjects.csv"} ref={ref} theme={theme} /> ))} /> 您可以在 theme.js 文件中的调色板中设置悬停颜色,并使用该颜色,如 theme.palette.${hoverColor} 请检查此测试组件。 https://codesandbox.io/p/sandbox/mui-28251-28335-forked-j2x8cd?file=%2Fsrc%2FApp.js 也许您可以让按钮将它们重定向到可以下载文件的 MediaFire: <a href="link-to-media"><button class="buttonClass">Download</button></a> 然后你可以将buttonClass修改为你喜欢的任何内容。


“限制将街景标记添加到传单地图中的特定区域

我决定通过创建挪威夏季的公路旅行地图来开始学习 Leaflet 和 JavaScript,这是我的项目的可重复示例: 我决定通过创建挪威夏季的公路旅行地图来开始学习 Leaflet 和 JavaScript,这是我的项目的可重复示例: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" /> <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/slick/slick.css"/> <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/[email protected]/slick/slick-theme.css"/> <script src="https://unpkg.com/leaflet/dist/leaflet.js"></script> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/slick/slick.min.js"></script> <link rel="stylesheet" href="https://unpkg.com/leaflet-routing-machine/dist/leaflet-routing-machine.css" /> <script src="https://unpkg.com/leaflet-routing-machine/dist/leaflet-routing-machine.js"></script> <style> body { margin: 0; } #map { width: 100%; height: 100vh; } .carousel { max-width: 300px; margin: 10px auto; } .carousel img { width: 100%; height: auto; } /* Custom styling for Geiranger popup content */ .geiranger-popup-content { max-width: 500px; padding: 20px; } </style> </head> <body> <div id="map"></div> <script> var map = L.map('map').setView([61.9241, 6.7527], 6); var streetViewMarker = null; // Variable to keep track of the Street View marker L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: '© OpenStreetMap contributors' }).addTo(map); var roadTripCoordinates = [ [59.9139, 10.7522], // Oslo [62.2622, 10.7654], // Tynset [62.5949, 9.6926], // Oppdal [63.0071, 7.2058], // Atlantic Road [62.1040, 7.2054] // Geiranger ]; // Function to initialize Slick Carousel for a specific marker function initSlickCarousel(markerId, images) { $(`#${markerId}_carousel`).slick({ infinite: true, slidesToShow: 1, slidesToScroll: 1, dots: true, arrows: true }); // Add images to the carousel images.forEach(img => { $(`#${markerId}_carousel`).slick('slickAdd', `<div><img src="${img}" alt="Image"></div>`); }); } // Add markers for each destination with additional information and multiple pictures var destinations = [ { coordinates: [59.9139, 10.7522], name: 'Oslo', info: "../07/2023 : Start of the road-trip", images: ['https://www.ecologie.gouv.fr/sites/default/files/styles/standard/public/Oslo%2C%20Norvege_AdobeStock_221885853.jpeg?itok=13d8oQbU', 'https://via.placeholder.com/300', 'https://via.placeholder.com/300'] }, { coordinates: [62.2622, 10.7654], name: 'Tynset', info: "../07/2023 : Fly-fishing spot 1", images: ['https://www.czechnymph.com/data/web/gallery/fisheries/norway/glommahein/Kvennan_Fly_Fishing_20.jpg', 'https://via.placeholder.com/300', 'https://via.placeholder.com/300'] }, { coordinates: [62.5949, 9.6926], name: 'Oppdal', info: "../07/2023 : Awesome van spot for the night", images: ['https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSFRtpLlHWr8j6S2jNStnq6_Z9qBe0jWuFH8Q&usqp=CAU', 'https://via.placeholder.com/300', 'https://via.placeholder.com/300'] }, { coordinates: [63.0071, 7.2058], name: 'Atlantic Road', info: "../07/2023 : Fjord fishing", images: ['https://images.locationscout.net/2021/04/atlantic-ocean-road-norway.jpg?h=1100&q=83', 'https://via.placeholder.com/300', 'https://via.placeholder.com/300'] }, { coordinates: [62.1040, 7.2054], name: 'Geiranger', info: "../07/2023 : Hiking 1", images: ['https://www.fjordtours.com/media/10968/nicola_montaldo-instagram-26th-may-2021-0717-utc.jpeg?anchor=center&mode=crop&width=1120&height=1120&rnd=133209254300000000&slimmage=True', 'https://via.placeholder.com/300', 'https://via.placeholder.com/300'] } ]; // Use Leaflet Routing Machine with Mapbox Routing plugin to get and display the route L.Routing.control({ waypoints: roadTripCoordinates.map(coord => L.latLng(coord[0], coord[1])), router: L.Routing.mapbox('MAP_BOX_KEY'), draggableWaypoints: false, addWaypoints: false, lineOptions: { styles: [{ color: 'brown', opacity: 0.7, weight: 2 }] } }).addTo(map); // Remove the leaflet-routing-container from the DOM var routingContainer = document.querySelector('.leaflet-routing-container'); if (routingContainer) { routingContainer.parentNode.removeChild(routingContainer); } destinations.forEach(function (destination) { var marker = L.marker(destination.coordinates).addTo(map); var markerId = destination.name.replace(' ', '_'); marker.bindPopup(` <b>${destination.name}</b><br> ${destination.info}<br> <div class="carousel" id="${markerId}_carousel"></div> `).on('popupopen', function () { // Initialize Slick Carousel when the marker popup is opened initSlickCarousel(markerId, destination.images); }).openPopup(); }); // Add Street View panorama on map click map.on('click', function (e) { if (streetViewMarker) { // Remove the existing Street View marker map.removeLayer(streetViewMarker); } let lat = e.latlng.lat.toPrecision(8); let lon = e.latlng.lng.toPrecision(8); streetViewMarker = L.marker([lat, lon]).addTo(map) .bindPopup(`<a href="http://maps.google.com/maps?q=&layer=c&cbll=${lat},${lon}&cbp=11,0,0,0,0" target="blank"><b> Cliquer ici pour avoir un aperçu de la zone ! </b></a>`).openPopup(); }); </script> </body> </html> 一切都按预期进行,我不得不说我对渲染非常满意。然而,通过查看 Stackoverflow 上的不同主题,我发现可以通过单击地图来显示 Google 街景视图。这个功能真的很酷,但我想限制仅在我的公路旅行行程中添加街景标记的选项。 有人可以帮我吗? 您通过创建挪威夏季公路旅行地图开始了学习 Leaflet 和 JavaScript 的旅程,真是太棒了。到目前为止,您的项目设置看起来不错,我很乐意在您的进展过程中提供指导或帮助。 既然您已经包含了 Leaflet、Slick Carousel 和 Leaflet Routing Machine 库,看来您正计划使用 Slick Carousel 创建一个带有路线的交互式地图,也许还有一些附加功能。 以下是一些增强您的项目的建议: 地图初始化: 使用初始视图和要显示的任何特定标记或图层设置您的传单地图。 路由功能: 利用 Leaflet Routing Machine 将动态路线添加到您的地图。您可以自定义路线、添加航点并提供逐向指示。 照片轮播: 既然您提到了公路旅行地图,请考虑集成 Slick Carousel 来展示旅途中关键地点的照片或描述。这可以为您的地图添加视觉上吸引人的元素。 地图控制: 探索 Leaflet 插件或内置控件以增强用户体验。例如,您可以添加缩放控件或比例尺。 响应式设计: 确保您的地图能够响应不同的设备。 Leaflet 通常适合移动设备,但如果需要的话进行测试和调整是一个很好的做法。 数据层: 如果您有与您的公路旅行相关的特定数据点或事件,您可以使用标记或其他视觉元素在地图上表示它们。 JavaScript 交互性: 使用 JavaScript 为地图添加交互性。对于 ㅤ 实例,当用户单击标记时,您可以创建包含附加信息的弹出窗口。 记得迭代测试你的项目,并参考每个库的文档以获取详细的使用说明。 如果您有具体问题或在此过程中遇到挑战,请随时提问。祝您的公路旅行地图项目好运!


© www.soinside.com 2019 - 2024. All rights reserved.