I am trying to download and create media images with Media Services.
It's a really simple script. But the problem is that umbraco cant see a file of the data I am getting.
I have a legit image from the stream. But umbraco returns:
The best overloaded method match for 'Umbraco.Core.Models.ContentBase.SetPropertyValue(string, string)' has some invalid arguments
Hi there.
Thanks for putting me on the right track. I found another way to fetch the image. It's working now. :-)
var mediaService = Services.MediaService;
using (WebClient client = new WebClient())
{
Stream s = client.OpenRead("http://img.youtube.com/vi/q7Uv_e2fkvo/hqdefault.jpg");
using (MemoryStream ms = new MemoryStream())
{
s.CopyTo(ms);
var mediaImage = mediaService.CreateMedia("hqdefault", 2634, "Image");
mediaImage.SetValue("umbracoFile", "hqdefault.jpg", ms);
mediaService.Save(mediaImage);
}
}
Media service download image from web
Hi there forum.
I am trying to download and create media images with Media Services. It's a really simple script. But the problem is that umbraco cant see a file of the data I am getting. I have a legit image from the stream. But umbraco returns:
My code is:
Does anyone know why Umbraco cant see the file?
//Cheers Peter
You are using the setvalue that sets the path of the file, but you have the actual file at hand. try with this code:
Hi Alessandro, thanks for helping me out. It's not really working. Now I get an error:
Hi there. Thanks for putting me on the right track. I found another way to fetch the image. It's working now. :-)
is working on a reply...