Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I have links to pictures which need to be saved in an ImageCropper-Field.
Has anyone maybe done this before?
If I insert the Link the ImageCropper just points to it but cant resize it.
Can anyone provide samplecode?
I am not 100% sure I fully understand your question, what are you trying to achieve here?
When you say link, what type of datatype is this?
With some more details I am sure I can help or someone else with a few more details.
Its a Link in form of a String and I wanted to save the image (the link leads to) into an imagecropper. It works now.
I just had to create a FileStream-Object of the Image and I was able to just asign it to the property.
OK I am glad you solved your own problem then.
Maybe to help others who search or come across the same problem is to post a code snippet so others can benefit from it too.
Of Course ;)
IContent myDoc = \\get or create ur Doc here
string tempFolder = umbraco.GlobalSettings.FullpathToRoot + "//temp//"; string linkToImage = "http://somewebsite.com/mypic.jpg";
Uri imageUrl = new Uri(linkToImage);
string filename = Path.GetFileName(imageUrl.PathAndQuery);
webClient.DownloadFile(linkToImage, tempFolder + filename);
FileStream fs = new FileStream(tempFolder + filename, FileMode.Open);
myDoc.SetValue("anzeigeBild", filename, fs);
foreach (FileInfo file in new DirectoryInfo(tempFolder).GetFiles()) file.Delete();
This worked for me. It was fast enough. Maybe there is a way to do this without saving the file to disk before creating a filestream. I just had to run this once, so this was fine for me.
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted