简体   繁体   English

来自php url的facebook发布图像

[英]facebook post images from php url

i have a mysql table where i store all the images uploaded by users (in a blob column). 我有一个mysql表,其中存储了用户上传的所有图像(在blob列中)。

To show the images on my website I use a simple script, like this: 为了显示网站上的图像,我使用了一个简单的脚本,如下所示:

  $res = mysql_query("SELECT image FROM table WHERE id=$id");
  $row = mysql_fetch_assoc($res);
  header("Content-type: image/jpeg");
  echo $row['dvdimage'];

and then i call the image with: < img src="script.php?id=1" /> 然后我用以下图像调用图像: < img src="script.php?id=1" />

Everything works fine in my website, the image is shown, but when I share the link or post the image on facebook the thumbnail of the image is not visible... 在我的网站上一切正常,显示了图像,但是当我共享链接或将图像发布到facebook上时,图像的缩略图不可见...

I don't understand if the error is mine (for example I just have to add some headers in the script.php file, or i can use htaccess to resolve the problem) 我不知道错误是否是我的(例如,我只需要在script.php文件中添加一些标题,或者我可以使用htaccess来解决问题)

...or if the blob/php is a bad practice to store the images in this case.. ...或者在这种情况下,如果blob / php是不好的做法来存储图像。

When you share a link on Facebook it crawl the url and fetch data. 当您在Facebook上共享链接时,它会爬网URL并获取数据。 You can check here what data is Facebook getting from your url. 您可以在此处查看Facebook从您的网址获取的数据。

To tell Facebook what information to show using og tags. 告诉Facebook使用og标签显示哪些信息。 Adding headers are not enough to Facebook to detect content. 仅向Facebook添加标头不足以检测内容。

Check here to get more info about open graph protocol. 单击此处以获取有关开放图协议的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM