Using the Umbraco media services to create a media item from an image uploaded to a specified directory
Hi all,
I am some difficulty using the Umbraco media services to create usable media objects, particularly of media type "Image".
As a bit of background, we have a piece of software that allows our clients to define products, their description, associated images and other information that can then be accessed via a web service and displayed within our Umbraco powered site. I am using this web service in Umbraco to create content pages based upon the data retrieved from the web service which is actually fairly simple. My main issue though is processing the associated images
An associated image in the web service is literally defined as a path to an image on the users machine such as:
"C:\Users\jason\My Pictures\Test\test.jpg"
Clearly this image cannot be sent as a stream via the web service so I will be allowing our users to upload the images via FTP to a folder within the Umbraco directory named "uploadedImages".
When the automated web service call is run in Umbraco (nightly), the local path will be converted so that it relates to an image that has been uploaded to the server. So
"C:\Users\jason\My Pictures\Test\test.jpg"
would become
"\uploadedImages\Test\test.jpg"
What I then wish to do is convert this image to a Media item in Umbraco so that it becomes:
"\Media\Test\1001\test.jpg"
I would then clear all files from the 'uploadedImages' folder as this would no longer be required.
So for example the following shows the structure of the 'uploadedImages' folder as of today:
Using the Umbraco media services to create a media item from an image uploaded to a specified directory
Hi all,
I am some difficulty using the Umbraco media services to create usable media objects, particularly of media type "Image".
As a bit of background, we have a piece of software that allows our clients to define products, their description, associated images and other information that can then be accessed via a web service and displayed within our Umbraco powered site. I am using this web service in Umbraco to create content pages based upon the data retrieved from the web service which is actually fairly simple. My main issue though is processing the associated images
An associated image in the web service is literally defined as a path to an image on the users machine such as:
Clearly this image cannot be sent as a stream via the web service so I will be allowing our users to upload the images via FTP to a folder within the Umbraco directory named "uploadedImages".
When the automated web service call is run in Umbraco (nightly), the local path will be converted so that it relates to an image that has been uploaded to the server. So
would become
What I then wish to do is convert this image to a Media item in Umbraco so that it becomes:
I would then clear all files from the 'uploadedImages' folder as this would no longer be required.
So for example the following shows the structure of the 'uploadedImages' folder as of today:
After parsing, the media folder structure would look something like this
My main issue is I don't know how to pass the image from it's location in 'uploadedImages' into the Media service to achieve this output.
Currently I have the following where 'image' is a dummy path I have defined myself:
What I need to know is how I then pass the file located here:
into the MediaService.
I cannot find anything relating to this in the documentation or on the forums so any help would be greatly appreciated.
is working on a reply...