本文介绍了如果存在,则将图像上传到相册,否则创建新相册 - Facebook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

经过一番努力,我有了一些将图片上传到 Facebook 的代码,但现在的问题是它总是会创建一个新相册.
我想修改代码,以便它仅在没有同名专辑时才创建专辑;否则,只需将图像上传到现有相册.

After some hardwork I have some code that uploads an image to Facebook, but now the problem is that it always creates a new album.
I want to modify the code so that it only creates an album if there isn't already one with that name; otherwise, just upload the image to the existing album.

我上传图片的代码:上传照片到Facebook相册来自应用程序

推荐答案

API 允许您将图像上传到应用程序的现有相册.只需发布到 https://graph.facebook.com/USER_ID/photos - 照片将是发布到为您的应用创建的相册.如果您的应用尚不存在,我们会自动为您的应用创建相册.以这种方式上传的所有照片都会添加到同一个相册中.

The API allows you to upload an image to an existing album for your app. Simply POST to https://graph.facebook.com/USER_ID/photos - The photo will be published to an album created for your app. We automatically create an album for your app if it does not already exist. All photos uploaded this way will then be added to this same album.

如果您想将图片添加到特定相册,您必须发布到 https://graph.facebook.com/ALBUM_ID/photos - 照片将发布到特定的现有相册,由 ALBUM_ID 表示.

If you want to add images to a specific album, you must POST to https://graph.facebook.com/ALBUM_ID/photos - The photo will be published to a specific, existing photo album, represented by the ALBUM_ID.

详细的操作指南在这里:https://developers.facebook.com/blog/post/498

A detailed How-To Guide is here: https://developers.facebook.com/blog/post/498

这篇关于如果存在,则将图像上传到相册,否则创建新相册 - Facebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-06 20:46