Creation of New Media item with a location other than the media folder adds the media on to the URL
I'm building a new Contour Workflow so that the newly uploaded file from the standard File Upload Contour DataType creates a media item pointing to the file uploaded on disk by Contour. Then I also create crops. I'm using 4.11.4.
My problem is that when I create the media item and point the "umbracoFile" property to the location Contour saved it, its adding the /media folder to the url somewhere. Contour uploads to a directory something like: /umbraco/plugins/umbracoContour/files/69c88fbf-2373-40ec-ad85-1b120a855c5a/98b31a76-6998-441e-bd85-10492c2a71ba/photo_1.JPG.
Here is a snippet of the code to build the media item:
var n =Media.MakeNew(fileNameWOExt, MediaType.GetByAlias("Image"), newUser(0), parentId); n.getProperty("umbracoFile").Value = filewithpath;
When I browse to the media item in the Media section of the Umbraco admin I don't get a thumbnail instead on the first tab I see a link with the following realtive URL:
I just installed DAMP and it didn't create the crops after submitting my Contour form. The media item is created and if I save it the crops get created and built correctly. Does it only work for media attached to document properties that have DAMP as their data type? Should it work with the default Media Picker?
I am seeing this exception in the Umbraco Log:
Exception: Object reference not set to an instance of an object. - StackTrace: at DigibizAdvancedMediaPicker.DigibizAdvancedMediaPicker.ConvertXML(XDocument xmlDocument)
Ah yes. Well, I did upgrade this from 4.7.0 to 4.7.2 then to 4.11.4 recently. So perhaps its a similar issue. However, I just installed DAMP on 4.11.4. It wasn't present before that version.
Thanks for looking into it. I appreciate it. Let me know if I can help with anything.
I saw read this post after enquiring on a separate thread from Jason.
I am trying to map a Contour file upload field to document Upload or Media Picker or Media Item (in a specified folder) via the Document Create workflow.
Seems like Jason and Sören figured a way to achieve this, would you be able to share the source/project file that I can test or customize ?
Would really appreciate your help! if you prefer to share the source privately my email is akeilox (a) gmail.com
Creation of New Media item with a location other than the media folder adds the media on to the URL
I'm building a new Contour Workflow so that the newly uploaded file from the standard File Upload Contour DataType creates a media item pointing to the file uploaded on disk by Contour. Then I also create crops. I'm using 4.11.4.
My problem is that when I create the media item and point the "umbracoFile" property to the location Contour saved it, its adding the /media folder to the url somewhere. Contour uploads to a directory something like: /umbraco/plugins/umbracoContour/files/69c88fbf-2373-40ec-ad85-1b120a855c5a/98b31a76-6998-441e-bd85-10492c2a71ba/photo_1.JPG.
Here is a snippet of the code to build the media item:
var n = Media.MakeNew(fileNameWOExt, MediaType.GetByAlias("Image"), new User(0), parentId);
n.getProperty("umbracoFile").Value = filewithpath;
When I browse to the media item in the Media section of the Umbraco admin I don't get a thumbnail instead on the first tab I see a link with the following realtive URL:
/media/umbraco/plugins/umbracoContour/files/69c88fbf-2373-40ec-ad85-1b120a855c5a/98b31a76-6998-441e-bd85-10492c2a71ba/photo_1.JPG
Any ideas why the /media is there? Is that added automatically somehow?
Thanks,
Jason
Comment author was deleted
Hmm maybe try adding a tilde to see if that changes anything
Alternatively you could move the file to the media folder
Yea, I tried the tilde and it didn't work. I'll try re-saving into the media area.
Thanks,
Jason
Yep, resaving worked fine. Now if I could get the crops to work... :)
Thanks for all your help Tim!
I'll send back my project code when its complete and hopefully it will help you for the next version.
Thanks,
Jason
Comment author was deleted
Great :) what are you using for cropping? I'm sure there is already some code out there that can help
Comment author was deleted
If you are using the Image Cropper datatype http://our.umbraco.org/projects/backoffice-extensions/create-crops
Yea, I am using that, but its not working for some reason. If I can get that package working, then I'm sure the whole process will work great.
Thanks,
Jason
Did you try to install DAMP 2.5? If you create media it will create the crops for you with events. Should be pretty easy :).
Jeroen
Can I use DAMP in a Contour workflow?
Thanks,
Jason
I don't think so, but if you install it the events will always work if a media items is saved/created. Also if that happens in the Contour workflow.
Jeroen
Oh! I didn't realize it created crops when all media was created. Even when creating through the API? I'll try it out!
Thanks,
Jason
Yes it should always work :-).
Jeroen
I just installed DAMP and it didn't create the crops after submitting my Contour form. The media item is created and if I save it the crops get created and built correctly. Does it only work for media attached to document properties that have DAMP as their data type? Should it work with the default Media Picker?
I am seeing this exception in the Umbraco Log:
Exception: Object reference not set to an instance of an object. - StackTrace: at DigibizAdvancedMediaPicker.DigibizAdvancedMediaPicker.ConvertXML(XDocument xmlDocument)
Thanks,
Jason
It should work for all media. Strange that it doesn't. Looks like it's the same error as in this topic: http://our.umbraco.org/projects/backoffice-extensions/digibiz-advanced-media-picker/digibiz-advanced-media-picker/38202-Images-disappeared-after-upgrade-to-25
I'll try to have a look at it this weekend.
Jeroen
Ah yes. Well, I did upgrade this from 4.7.0 to 4.7.2 then to 4.11.4 recently. So perhaps its a similar issue. However, I just installed DAMP on 4.11.4. It wasn't present before that version.
Thanks for looking into it. I appreciate it. Let me know if I can help with anything.
Thanks,
Jason
The error in the log should be fixed in the latest change set: http://damp.codeplex.com/SourceControl/list/changesets?branch=default
The crop should work for everything if the DAMP settings are true in the web.config.
Jeroen
Where in the web.config should I look to verify the settings are set to true? I'm not seeing any DAMP elements.
Thanks,
Jason
Nevermind, Google to the rescue. Found this old forum post:
http://our.umbraco.org/projects/backoffice-extensions/digibiz-advanced-media-picker/digibiz-advanced-media-picker/26471-Automatic-Crop-doesnt-work
And now it works! Jeroen, thanks for your help! Buy you a beer at Codegarden!
Thanks,
Jason
Hi,
I have the same problem like Jason at first. Can you explain me, what do you mean with moving to media section or resaving in mediasection, please?
Best regards
Sören
I have solved my problem with this code:
Best regards
Sören
I saw read this post after enquiring on a separate thread from Jason.
I am trying to map a Contour file upload field to document Upload or Media Picker or Media Item (in a specified folder) via the Document Create workflow.
Seems like Jason and Sören figured a way to achieve this, would you be able to share the source/project file that I can test or customize ?
Would really appreciate your help! if you prefer to share the source privately my email is akeilox (a) gmail.com
thank you!
is working on a reply...