Need help to create a "Media" Item to access a Thumbnail already created by the Umbraco MediaService
Dear Umbraco Folk,
I am using the following code to to create a Umbraco Media Item of type "Image":
var ms = ApplicationContext.Current.Services.MediaService;
.// Create the "empty" Image definition as an umbraco Media node
var newImage = ms.CreateMedia(imageFileName, tTImagesFolderID, "Image");
.ms.Save(newImage);
.imageID = newImage.Id; // Capture the Image ID
// Now convert relative web path to physical path to on disk file
string physicalImagePath = System.Web.HttpContext.Current.Server.MapPath(imageSourcePathPrimaryString);
// Now open a "FileStream" to that file on the physical hard disk
System.IO.FileStream imageFileStream = new System.IO.FileStream(physicalImagePath, FileMode.Open);
string physicalImageFileName = imageFileStream.Name;
// Now use SetValue to populate the previosuly "empty" Image definition / umbraco Media node with the real file and it's associated properties
newImage.SetValue("umbracoFile", imageFileName, imageFileStream);
ms.Save(newImage); // Must save !!
imageFileStream.Close(); // Tidy up
This creates a Media Item with the ID "imageID" providing access to the primary image "box_product.jpg"
It also creates Thumbnails along with the original image a "numbered" folder in the /Media/ folder. That folder contains three images like the following:
What is the best way to create an Umbraco Media Item to access boxproductthumb.jpg (preferably using the existing Thumbnail rather than creating a new "numbered" folder in the /Media/ folder).?
Note that I need to access the thumnail via a Umbraco Media Item because I am using uCommerce and the uCommerce "Product" Class has the following properties:
Need help to create a "Media" Item to access a Thumbnail already created by the Umbraco MediaService
Dear Umbraco Folk,
I am using the following code to to create a Umbraco Media Item of type "Image":
This creates a Media Item with the ID "imageID" providing access to the primary image "box_product.jpg"
It also creates Thumbnails along with the original image a "numbered" folder in the /Media/ folder. That folder contains three images like the following:
What is the best way to create an Umbraco Media Item to access boxproductthumb.jpg (preferably using the existing Thumbnail rather than creating a new "numbered" folder in the /Media/ folder).?
Note that I need to access the thumnail via a Umbraco Media Item because I am using uCommerce and the uCommerce "Product" Class has the following properties:
I need to pupulate these with Media Item IDs.
Thanks
Terry Clancy
ClanceZ
is working on a reply...