Facebook Graph API - 图像方向错误
我将应用程序的方向修复为仅横向。
这就是我获取屏幕截图的方式。
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
来更改方向
UIImage * landscapeImage = [[UIImage alloc] initWithCGImage: img.CGImage scale: 1.0 orientation: UIImageOrientationRight];
我通过使用 fb iOS SDK 将屏幕截图发布到 facebook
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
landscapeImage, @"picture",
SOME_URL,@"link",
@"Have fun",@"name",
@"Join the fun",@"message",
@"0",@"position",
nil];
[_facebook requestWithGraphPath:@"me/photos"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
。问题是我无法控制方向,上传图像的方向始终是或者
-----
| |
| P |
-----
,
-----
| |
| q |
-----
但我希望图像水平放置(横向)。
-------
| |
-------
提前致谢!
I fix my app's orientation to be landscape only.
This is how I get the screenshot.
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
and I change the orientation through
UIImage * landscapeImage = [[UIImage alloc] initWithCGImage: img.CGImage scale: 1.0 orientation: UIImageOrientationRight];
I use fb iOS SDK to post the screenshot to facebook.
NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
landscapeImage, @"picture",
SOME_URL,@"link",
@"Have fun",@"name",
@"Join the fun",@"message",
@"0",@"position",
nil];
[_facebook requestWithGraphPath:@"me/photos"
andParams:params
andHttpMethod:@"POST"
andDelegate:self];
The problem is that I cannot control the orientation and the orientation of the uploaded images are always either
-----
| |
| P |
-----
or
-----
| |
| q |
-----
but i want the image to laid horizontally(landscape).
-------
| |
-------
thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是解决问题的方法。
UIimages的方向仅适用于“DISPLAY”,您需要重新绘制图像
here is how to resolve the problem.
UIimages's orientation is for "DISPLAY" only, you need to redraw the image