以上就是给各位分享.NET位图类无法打开LinkedIn的个人资料图像–关于如何打开任何build议?,同时本文还将给你拓展asp.net-mvc-4–LinkedIn在MVC4中使用DotNetOp
以上就是给各位分享.NET位图类无法打开LinkedIn的个人资料图像 – 关于如何打开任何build议?,同时本文还将给你拓展asp.net-mvc-4 – LinkedIn在MVC4中使用DotNetOpenAuth的完整个人资料、build议在.NET中创build命令行文本编辑器、c# – 如何在.NET中执行/打开任何文件、Django个人资料图片错误地显示了登录用户的图片(在每个个人资料上)等相关知识,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!
本文目录一览:- .NET位图类无法打开LinkedIn的个人资料图像 – 关于如何打开任何build议?
- asp.net-mvc-4 – LinkedIn在MVC4中使用DotNetOpenAuth的完整个人资料
- build议在.NET中创build命令行文本编辑器
- c# – 如何在.NET中执行/打开任何文件
- Django个人资料图片错误地显示了登录用户的图片(在每个个人资料上)
.NET位图类无法打开LinkedIn的个人资料图像 – 关于如何打开任何build议?
我正在尝试将LinkedIn个人资料图像下载到.NET应用程序中。 应用程序尝试打开图像,并resize,裁剪,然后将图像重新保存为PNG图像格式。 应用程序将图像加载到stream中。 然后它试图从stream中实例化一个.NET位图types。 位图types不能实例化,总是有一个“参数无效”错误,在实例化过程中返回。
似乎所有LinkedInconfiguration文件图像都不能由本地.NET Bitmap()API打开。 即我的个人资料图片是http://img.zgserver.com/c%23/11d2b5e.jpg 。 来自其他网站的图片可以打开罚款。 似乎可能像.NETgraphicsAPI本身不支持configuration文件图像的LinkedIn jpeg格式。 实际上,在本地保存jpg并尝试使用Windows本机应用程序打开它也失败了。
我如何打开和编辑这些图像,resize或裁剪等?
错误堆栈跟踪如下:
ProductName在Windowsregistry中,它是针对不同的语言本地化的?
2 AverageTimer32性能计数器
提前C#string比较
使用PHP和DOTNET类访问Windowsregistry
LINQ to sql – FROM X WHERE X =“1”SELECT Y
[ArgumentException:参数无效。] System.Drawing.Bitmap..ctor(Stream stream)+411353
应用程序closuresC#Windows
什么是.NET文件夹search层次结构?
Windows事件日志
Wpf绝对与相对包装URI
在2015年在Linux中运行一个.NET应用程序
这是一个WebP图像。 使用ImageMagick的identify工具,我得到:
11d2b5e.jpg WEBP 200×200 200×200 + 0 + 0 8位sRGB 4.44KB 0.000u 0:00.00
你将不得不使用一个库来阅读这个图像。 这是一个 。
顺便说一句,你不喜欢GDI +的错误信息? 这是一个可以想象出来的错误。
为了增加Ed S. 建议和分析,我在https://developers.google.com/speed/webp/?csw=1上研究了WebP图像编码类型。 有一个官方的Windows WebP编解码器可以在https://developers.google.com/speed/webp/download下载。 Google的下载页面也提供了一个WebP到PNG转换器作为Windows命令行工具。 因此,可能PInvoke,可能作为一个计划B替代预先打包的.NET库。
下载Google WebP编解码器后,所有本机Windows图形应用程序(如Windows照片查看器和Windows资源管理器外壳程序)都能够打开并呈现WebP格式的图像。 但是,编解码器并没有本地集成到.NET位图API中,所以像Ed S.这样的第三方库。 建议,或通过PInvoke谷歌WebP解码器命令行工具,将做的伎俩。
我认为LinkedIn正在提供.jpg文件,因为个人资料图片具有.jpg扩展名。 在尝试处理.jpg时,我不一定知道真正的文件类型。 我想我的阻力最小的开发路径是首先使用本地的.NET位图API,如果失败,尝试其他图像库,如WebP.NET。 我想这个问题有更强大的解决方案。
asp.net-mvc-4 – LinkedIn在MVC4中使用DotNetOpenAuth的完整个人资料
在My AuthConfig.cs中,
Dictionary<string,object> linkedInExTradata = new Dictionary<string,object>(); linkedInExTradata.Add("Icon","../Images/linkedIn.png"); OAuthWebSecurity.RegisterClient( client: new App_Start.LinkedInCustomClient("xxxxxxxxxxxx","yyyyyyyyyyyyyyy"),displayName: "LinkedIn",exTradata: linkedInExTradata);
在LinkedIn Developer Kit中的linkedInCustomClient.cs中
public class LinkedInCustomClient : OAuthClient { private static XDocument LoadXDocumentFromStream(Stream stream) { var settings = new XmlReaderSettings { MaxCharactersInDocument = 65536L }; return XDocument.Load(XmlReader.Create(stream,settings)); } /// Describes the OAuth service provider endpoints for LinkedIn. private static readonly ServiceProviderDescription LinkedInServiceDescription = new ServiceProviderDescription { AccesstokenEndpoint = new MessageReceivingEndpoint("https://api.linkedin.com/uas/oauth/accesstoken",HttpDeliveryMethods.PostRequest),RequestTokenEndpoint = new MessageReceivingEndpoint("https://api.linkedin.com/uas/oauth/requestToken?scope=r_fullprofile",UserAuthorizationEndpoint = new MessageReceivingEndpoint("https://www.linkedin.com/uas/oauth/authorize",TamperProtectionElements = new ITamperProtectionChannelBindingElement[] { new HmacSha1SigningBindingElement() },ProtocolVersion = ProtocolVersion.V10a }; public LinkedInCustomClient(string consumerKey,string consumerSecret) : base("linkedIn",LinkedInServiceDescription,consumerKey,consumerSecret) { } /// Check if authentication succeeded after user is redirected back from the service provider. /// The response token returned from service provider authentication result. [SuppressMessage("Microsoft.Design","CA1031:DoNotCatchGeneralExceptionTypes",Justification = "We don't care if the request fails.")] protected override AuthenticationResult VerifyAuthenticationCore(AuthorizedTokenResponse response) { // See here for Field Selectors API http://developer.linkedin.com/docs/DOC-1014 const string profileRequestUrl = "https://api.linkedin.com/v1/people/~:(id,first-name,last-name,interests,headline,industry,summary,email-address,location:(name),picture-url,positions,associations,languages,honors,educations,date-of-birth,primary-twitter-account,three-current-positions,three-past-positions,group-memberships,specialties,skills)"; string accesstoken = response.Accesstoken; string tokenSecret = (response as ITokenSecretContainingMessage).TokenSecret; string Verifier = response.ExTradata.Values.First(); var profileEndpoint = new MessageReceivingEndpoint(profileRequestUrl,HttpDeliveryMethods.GetRequest); HttpWebRequest request = WebWorker.PrepareAuthorizedRequest(profileEndpoint,accesstoken); try { using (WebResponse profileResponse = request.GetResponse()) { using (Stream responseStream = profileResponse.GetResponseStream()) { XDocument document = LoadXDocumentFromStream(responseStream); return new AuthenticationResult( isSuccessful: true,provider: ProviderName,providerUserId: userId,userName: userName,exTradata: exTradata); } } } catch (Exception exception) { return new AuthenticationResult(exception); } } }
在我的控制器中,
AuthenticationResult result = OAuthWebSecurity.VerifyAuthentication(Url.Action("ExternalLoginCallback",new { ReturnUrl = returnUrl })); if (!result.IsSuccessful) { return RedirectToAction("ExternalLoginFailure"); }
我需要在控制器中获取以下详细信息作为身份验证结果.
(id,skills)
解决方法
要获取电子邮件字段,您需要将请求令牌网址修改为
RequestTokenEndpoint = new MessageReceivingEndpoint(“https://api.linkedin.com/uas/oauth/requestToken?scope=r_fullprofile r_emailaddress”,
HttpDeliveryMethods.PostRequest)
您可以按照以下代码中的要求获取字段
XDocument document = LoadXDocumentFromStream(responseStream);
例如:要从xml文件中获取名字字段,
var firstName = document.Root.Element("first-name").Value;
语言,职位,技能等字段将作为结构对象返回,作为配置文件的一部分.
例如:语言领域.
var Lang = document.Root.Element("languages"); var languages = new List<string>(); if (Lang != null) { foreach (var l in Lang.Elements()) { if (l.Element("language") != null && l.Element("language").Element("name") != null) { languages.Add(l.Element("language").Element("name").Value); } } }
然后,您可以将字段添加到“exTradata”,可以在控制器中访问.
exTradata.Add("firstName",firstName); exTradata.Add("languages",lang);
build议在.NET中创build命令行文本编辑器
我想用.Net创build一个命令行文本编辑器。
我总是做graphics用户界面应用程序,所以我完全处理这个任务有点失落。 我需要知道的第一件事是如何创build一个可滚动的编辑区。 一个我可以写任何我想要的东西,上下移动的地方。 也许有一个我没有find的即可使用的框架。 所以出于这个原因,我正在征求意见。
另一件事是如何创build一个菜单栏,在滚动时不会随编辑器区域移动。
总结一下,我想为Windows控制台创build一个非常简单的编辑器,如EDIT。
如何在C#中使用Process.Start中的空格处理值
基于服务的数据库
Windbg可以显示线程名称吗?
我应该将敏感数据传递给.NET中的Process.Start调用吗?
活动目录属性“badPwdCount”
“无法启动Omnisharp,因为需要Mono版本> = 3.10.0”
如何将Windowsauthentication信息存储在数据库中
得到所有打开的窗口的标题
我怎样才能看到caspol认为一个代码段属于哪个区域?
无法findtypes或名称空间名称“ServiceController”
我不知道cua是什么意思,但是…
您可以使用Console.SetCursorPosition()来设置光标的位置,以允许在需要的地方写入数据。
例:
public void Run() { Console.WriteLine("Hello,World."); Console.WriteLine("buffer size: (w,h)= ({0},{1})",Console.BufferWidth,Console.BufferHeight); Console.WriteLine("position= ({0},Console.CursorLeft,Console.CursorTop); Console.WriteLine("Hello,again."); Console.WriteLine("position= ({0},Console.CursorTop); int x= 2000; Console.WriteLine("nnnCounting to {0}...",x); int left= Console.CursorLeft; int top= Console.CursorTop; for (int i= 0; i < x; i++) { Thread.Sleep(5); Console.SetCursorPosition(left,top); Console.Write("{0,6}",i); } Console.WriteLine("nnndone."); }
鉴于此功能,您可以构建更强大的小部件,如菜单栏,命令栏等。
我不知道如何使用托管代码在控制台的指定位置“阅读”文本; 你可以通过pInvoke来完成。 您需要从屏幕读取以支持剪切/粘贴操作,搜索等。 即使有pInvoke的可能性,我也会建议采用双缓冲写入的方法,在托管代码中维护缓存到屏幕上。 像这样的东西:
http://code.google.com/p/console-forms/source/browse/trunk/Console.Forms/Console.Forms/Drawing/ConsoleCanvas.cs?spec=svn9&r=9
然后,当你需要从“控制台”读取时,只需从缓冲区读取。 这样避免了每次读取都会跨越pInvoke阈值,这个开销很大。
有了这些成分,您就拥有了一个控制台模式编辑器的基本构建模块。
c# – 如何在.NET中执行/打开任何文件
解决方法
Process proc = new Process(); proc.StartInfo.FileName = "file.doc"; proc.StartInfo.UseShellExecute = true; proc.Start();
Django个人资料图片错误地显示了登录用户的图片(在每个个人资料上)
如何解决Django个人资料图片错误地显示了登录用户的图片(在每个个人资料上)?
在此方面的任何帮助将不胜感激。
我将具有OnetoOne关系的Django User模型扩展到另一个名为UserProfile的模型,该模型包含一个名为profile_pic的ImageField。
在settings.py中正确设置了根媒体文件夹的设置,并在root urls.py中对其进行了引用。
基于类的视图,用于显示用户产品帖子的通用ListView可能不正确,或者我在模板中错误地引用了profile_pic。
关于如何在每个用户的关联用户个人资料上显示其个人资料图像的任何想法?当前,当用户登录时,他/她的图像显示在每个配置文件上。使用Django 3.1.2
models.py
class UserProfile(models.Model):
user = models.OnetoOneField(User,on_delete=models.CASCADE)
profile_pic = models.ImageField(default=''default_profile_pic.jpg'',upload_to=''profile_pics'')
class Meta:
verbose_name_plural = "User Profiles"
def __str__(self):
return f''{self.user.username} UserProfile''
def save(self,*args,**kwargs):
super().save(*args,**kwargs)
views.py
class ProfileListView(ListView):
model = Product
template_name = ''users/profile.html''
context_object_name = ''products''
paginate_by = 12
def get_queryset(self):
user = get_object_or_404(User,username=self.kwargs.get(''username''))
return Product.objects.filter(user=user).order_by(''-creation_date'')
profile.html
{% if user.userprofile.profile_pic %}
<imgsrc="{{ user.userprofile.profile_pic.url }}" alt="">
{% else %}
<imgsrc="media/default_profile_pic.jpg" alt="">
{% endif %}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
关于.NET位图类无法打开LinkedIn的个人资料图像 – 关于如何打开任何build议?的介绍现已完结,谢谢您的耐心阅读,如果想了解更多关于asp.net-mvc-4 – LinkedIn在MVC4中使用DotNetOpenAuth的完整个人资料、build议在.NET中创build命令行文本编辑器、c# – 如何在.NET中执行/打开任何文件、Django个人资料图片错误地显示了登录用户的图片(在每个个人资料上)的相关知识,请在本站寻找。
本文标签: