November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Hey Bartosz,
private void CreateImageInBlob(IContentMedia contentImage, string imageInfo, Stream resizedImages)
{
var imageBlobContainer = _imageFile.BinaryDataContainer.Scheme + "://default/" + _imageFileName; //blob container folder name
var blob = ServiceLocator.Current.GetInstance<IBlobFactory>().CreateBlob(new Uri(imageBlobContainer), Path.GetExtension(_imageFile.Name));
//some code to rename image blob from GUID to image name _ image size
blob.Write(resizedImages); //image blob is created
contentImage.BinaryData = blob;
_contentRepository.Save(contentImage, SaveAction.Publish);
}
Is this even possible? If not, what are your recomendation to get to simillar suitable solution.
I was just looking at the source code last week and the blob provider creates a new Guid.NewGuid() for the filename and it is not overwritable unfortunately. From their source
public static Uri NewBlobIdentifier(Uri container, string extension)
{
Validator.ThrowIfNull("container", container);
Validator.ThrowIfNullOrEmpty("extension", extension);
ValidateIdentifier(container, false);
if (Path.GetExtension(extension) != extension)
{
throw new ArgumentException("Not a valid file extension", extension);
}
return new Uri(container, container.AbsolutePath + "/" + GuidToUriString(Guid.NewGuid()) + extension);
}
Hi,
I wrote some code so when an editor uploads an image different sizes of the uploaded image are created and save to a blob in aws, in the format epi.fx.blob://[provider]/[container]/[blob]]
While I can change the container portion, I am having problems figuring out how to change the blob portion of uri which is the image, to the image name plus the size it was changed to.
Any ideas on how to do this?