通Base64编码的jpeg图像OG:图像 [英] Pass Base64 jpeg image to og:image

查看:209
本文介绍了通Base64编码的jpeg图像OG:图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个在运行时所产生在我的网站的形象和我在HTML中使用显示它

I have image that is being generated in runtime on my website and I display it in html using

<img src="data:image/jpeg;base64,<!-- base64 data -->" />

现在,我要为Facebook获取这一形象,但如果我做OG相同的:像meta标签,Facebook的调试器给我一个错误。任何解决方案?

Now, I want for Facebook to fetch this image, but if I do the same for og:image meta tag, facebook debugger gives me an error. Any solution?

<meta property='og:image' content='data:image/jpeg;base64,<!-- base64 data -->'/>

当然,我想避免的文件永久保存,因为它们总是不同的,那就太拥挤非常快

Of course, I would like to avoid permanent saving of files since they are always different and it would get too crowded very quickly

推荐答案

PASE到一个PHP文件,呼应一下:

pase it to a php file that echo it out:

<meta property='og:image' content='decoder.php?data=<!-- base64 data -->'/>

德coder.php:

decoder.php:

<?php
    echo base64_decode($_GET['data']);
?>

修改
请务必检查源出于安全原因。

EDIT make sure you check source for security reason.

这篇关于通Base64编码的jpeg图像OG:图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆