Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Jason Prothero 422 posts 1243 karma points MVP c-trib
    Feb 17, 2013 @ 23:11
    Jason Prothero
    0

    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

    Feb 18, 2013 @ 09:39

    Hmm maybe try adding a tilde to see if that changes anything

    Alternatively you could move the file to the media folder

  • Jason Prothero 422 posts 1243 karma points MVP c-trib
    Feb 18, 2013 @ 16:54
    Jason Prothero
    0

    Yea, I tried the tilde and it didn't work.  I'll try re-saving into the media area.

    Thanks,
    Jason 

  • Jason Prothero 422 posts 1243 karma points MVP c-trib
    Feb 20, 2013 @ 21:18
    Jason Prothero
    0

    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

    Feb 21, 2013 @ 10:20

    Great :) what are you using for cropping? I'm sure there is already some code out there that can help

  • Comment author was deleted

    Feb 21, 2013 @ 10:40

    If you are using the Image Cropper datatype http://our.umbraco.org/projects/backoffice-extensions/create-crops

  • Jason Prothero 422 posts 1243 karma points MVP c-trib
    Feb 21, 2013 @ 16:53
    Jason Prothero
    0

    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

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 21, 2013 @ 16:55
    Jeroen Breuer
    0

    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

  • Jason Prothero 422 posts 1243 karma points MVP c-trib
    Feb 21, 2013 @ 17:14
    Jason Prothero
    0

    Can I use DAMP in a Contour workflow?  

     

    Thanks,
    Jason 

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 21, 2013 @ 17:18
    Jeroen Breuer
    0

    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

  • Jason Prothero 422 posts 1243 karma points MVP c-trib
    Feb 21, 2013 @ 17:24
    Jason Prothero
    0

    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

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 21, 2013 @ 17:27
    Jeroen Breuer
    0

    Yes it should always work :-).

    Jeroen

  • Jason Prothero 422 posts 1243 karma points MVP c-trib
    Feb 21, 2013 @ 19:53
    Jason Prothero
    0

    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 

     

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 22, 2013 @ 19:15
    Jeroen Breuer
    0

    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

  • Jason Prothero 422 posts 1243 karma points MVP c-trib
    Feb 22, 2013 @ 20:36
    Jason Prothero
    0

    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 

  • Jeroen Breuer 4908 posts 12265 karma points MVP 5x admin c-trib
    Feb 25, 2013 @ 20:50
    Jeroen Breuer
    0

    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

  • Jason Prothero 422 posts 1243 karma points MVP c-trib
    Feb 26, 2013 @ 19:45
    Jason Prothero
    0

    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

  • Jason Prothero 422 posts 1243 karma points MVP c-trib
    Feb 26, 2013 @ 19:52
    Jason Prothero
    0

    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

  • Sören Deger 733 posts 2844 karma points c-trib
    Jul 31, 2013 @ 16:53
    Sören Deger
    0

    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

  • Sören Deger 733 posts 2844 karma points c-trib
    Jul 31, 2013 @ 22:41
    Sören Deger
    0

    I have solved my problem with this code:

                var mediaService = ApplicationContext.Current.Services.MediaService;
    if (System.IO.File.Exists(newFile))
    {
    var media = mediaService.CreateMedia("Logo", 1234, "Image");
    FileStream fs = System.IO.File.OpenRead(HttpContext.Current.Server.MapPath(Logo));
    string fName = Logo.Substring(Logo.LastIndexOf('/')+1);
    media.SetValue("umbracoFile", fName, fs);
    mediaService.Save(media);
    }

    Best regards
    Sören

  • keilo 568 posts 1023 karma points
    Jun 14, 2014 @ 11:26
    keilo
    0

    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!

Please Sign in or register to post replies

Write your reply to:

Draft