Copied to clipboard

Flag this post as spam?

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


  • Jon 17 posts 37 karma points
    Jun 07, 2016 @ 00:36
    Jon
    0

    URLS for New Media files is being replaced by old media file links

    Hello,

    I was going in to use my umbraco site (Umbraco v6.0.2 (Assembly version: 1.0.4813.29744)) to create a new page with a rich text editor as a content section. What I did was add in my content and then uploaded new images into the rich text editor (and the media section). After I save and publish the images change to old existing images and replace all that I did before.

    This is the details of what I did:

    1) First I go into the page I want to edit and select an Image that I recently added into the media section: enter image description here

    2) If you can see the image is added in properly: enter image description here

    3) If you look at the src the source looks like this:

    <p><img src="/media/4186/setting-up-your-company-with-stripe-payments.001.png" alt="Setting Up Your Company With Stripe Payments 001" title="Setting Up Your Company With Stripe Payments 001" width="500" height="365" rel="624,456" /></p>
    

    enter image description here

    4) Now after I save and publish the file the Images change: enter image description here

    5) You can see the URL is now different:

    <p><img src="/media/4165/logo.png" alt="Setting Up Your Company With Stripe Payments 001" width="499" height="365" rel="192,43" /></p>
    

    (note the alt description is the same) enter image description here

    Can someone please help? This is causing me some grief. It does work for old files only newly added files to the media area do this.

    Thanks,

    Jon Clifford

  • Sagar 74 posts 275 karma points
    Jun 07, 2016 @ 10:37
    Sagar
    0

    Use--

    @{ 
    var image=(int)CurrentPage.alliasnameofpicker; 
    } 
    @if(image>0) {
        var i=Umbraco.TypedMedia(image);
        var allImages=i.Children(x=>x.DocumentTypeAllias=="mediatypealliasname").ToList();
         foreach(var im in allImages)
          {
             Your Code----
          }
    }
    

    Cheers Sagar------

  • Jon 17 posts 37 karma points
    Jun 09, 2016 @ 01:46
    Jon
    0

    Hello Sagar, Thanks for your reply. I'm not sure I understand where I should use the code you suggested. Can you please provide some more info?

    Thanks,

    Jon

  • Sagar 74 posts 275 karma points
    Jun 09, 2016 @ 04:18
    Sagar
    0
    1. Create a media type
    2. enter field of upload type
    3. open Media Types>Folder>Permission add that media type to the child and save it
    4. Now in Media create a folder and create a media type file which u had created
    5. Add an image in it
    6. Create another file of same media type in the same folder (if u want to add another image).
    7. Now in document type add a field in your page with media picker
    8. In content type add that folder from media through that media picker.
    9. Now create a Partial view add that code which i had provided previously

    Note :- remember the alias name properly and then provide it in your code

    @{ 
    var image=(int)CurrentPage.alliasnameofpicker; (alias name from document type)
    } 
    @if(image>0) {
        var i=Umbraco.TypedMedia(image);
        var allImages=i.Children(x=>x.DocumentTypeAllias=="mediatypealliasname")ToList();  (mediatypealliasname will be the alias name of your media type)
         foreach(var im in allImages)
          {
             Your Code----
          }
    }
    
Please Sign in or register to post replies

Write your reply to:

Draft