简体   繁体   English

如何使用C#/ JavaScript从URL获取图像

[英]How to get image from url using c# / javascript

I am using file picker apis , i can easily upload my files to there server and they give me a unique url in return . 我正在使用文件选择器API,我可以轻松地将文件上传到该服务器,并且它们会给我一个唯一的URL作为回报。 When it comes to again fetch that file its creating a problem to me . 当再次需要获取该文件时,这给我带来了麻烦。

You can tell me how to get back file using that url by using filepicker api . 您可以通过使用filepicker api告诉我如何使用该URL取回文件。 You can tell me how to use that url and get image , by using c# 您可以通过c#告诉我如何使用该网址并获取图片

When i upload a picture to filepicker.io they return me a json object like following 当我将图片上传到filepicker.io时,它们向我返回了一个json对象,如下所示

[{"url":"https://www.filepicker.io/api/file/kIrtNvQRta7GxlFVfiP2","filename":"brazil.jpg","mimetype":"image/jpeg","size":2660,"key":"ZML3OjrFTVyV4waBzRIT_brazil.jpg","isWriteable":true}]

So how to get back that image file using c# / Filepicket javascript api 那么如何使用C#/ Filepicket JavaScript API取回该图像文件

Edit In my site user will come and upload many photos , and every link to that photo will be stored in database . 编辑在我的网站的用户会来,并上传多张照片,每一个链接到该照片将被保存在数据库中。 Now if user want to see his uploaded pictures then i want to fetch them again from server by url . 现在,如果用户想查看他上传的图片,那么我想再次通过url从服务器获取它们。 So give your solutions acc. 因此,请根据您的要求提供解决方案。 to this scenario . 在这种情况下。

Thanks in advance 提前致谢

You could put the picture in a PictureBox first using: PictureBox.Load(string); 您可以先使用PictureBox.Load(string);将图片放入PictureBox PictureBox.Load(string); After the PictureBox is filled with the image from the url, you can decide what to do next like: saving etc. 在PictureBox中填充了网址中的图片后,您可以决定下一步要执行的操作:保存等。

PictureBox.Load 图片框

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

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