Copied to clipboard

Flag this post as spam?

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


  • Michael 24 posts 137 karma points
    May 02, 2015 @ 11:15
    Michael
    0

    Render entered alt text from image instead of caption

    Hi all

    I would like to alter the partials/grid/editors/media.cshtml file so it renders the alt text entered instead of the caption. Cause I want to remove the caption option.

    So my question is: What do I have to change @Model.value.caption to?

    The alt text is entered before you insert the image into the grid.

    Any pointers on how to do this? :)

  • Marc Goodson 2155 posts 14406 karma points MVP 9x c-trib
    May 02, 2015 @ 17:55
    Marc Goodson
    1

    Hi Michael,

    Yes this is an open issue at the moment with Umbraco:

    see: http://issues.umbraco.org/issue/U4-6193

    the alternative text is never passed back from the media picker and saved inside the grid, otherwise you could write Model.value.altText

    If you are desperate to get this working then you could temporarily edit the file:

    \Umbraco\Js\umbraco.controllers.js

    find .Controller("Umbraco.PropertyEditors.Grid.MediaController")

    as per the fix outlined in the issue

    and add altText: data.altText line to the $scope.control.value setting

    this would allow you to use the altText in the view...

     

  • Michael 24 posts 137 karma points
    Aug 05, 2015 @ 22:54
    Michael
    0

    Hi Marc

    Thank you for the reply. I finally got around to try it out.

    I updated my umbraco.controllers.js and my media.cshtml. I still can't get it to work. I will keep playing with it.

    /Michael

  • J 447 posts 864 karma points
    Sep 08, 2016 @ 12:56
    J
    0

    Did anyone get this resolved? Have the same issue after updating the 2 files above?

  • Marc Goodson 2155 posts 14406 karma points MVP 9x c-trib
    Sep 08, 2016 @ 13:03
    Marc Goodson
    0

    Hi J,

    This issue is marked as fixed in Umbraco 7.3+ so you shouldn't need to do this in the latest versions of Umbraco.

    If you are pre 7.3...

    then make sure you clear the client dependency framework by upping the version no in (/config/clientdependency.config)

    to make sure Umbraco is using the updated versions of the files

    regards

    Marc

  • J 447 posts 864 karma points
    Sep 08, 2016 @ 13:17
    J
    0

    Thanks Marc, so far it doesnt work. My steps:

    Changed js\umbraco.controllers.js added the below

    image: data.image,
    altText: data.altText
    

    In media.cshtml changed line 17 to

    <img src="@url" alt="@Model.value.altText" >
    

    under config\Clientdependency.config

    Changed

    <clientDependency version="12345678" fileDependencyExtensions=".js,.css"
    

    changed version to 12345679

    Am i missing something as when i refresh the page alt text is still not shown? So i added a manual alt entry in the cshtml file which does display?

    Thanks

  • Marc Goodson 2155 posts 14406 karma points MVP 9x c-trib
    Sep 10, 2016 @ 11:35
    Marc Goodson
    0

    Hi J

    Yes, that's all it should need, - which version of Umbraco is this ? (and I'll try to replicate)

    the grid has changed slightly in the later versions (but then also this problem has been fixed).

    I'd try adding a console.log of the data to see if the altText is being returned from the mediaPicker dialog service correctly:

      console.log(data);
                        $scope.control.value = {
                            focalPoint: data.focalPoint,
                            id: data.id,
                            image: data.image,
                            altText: data.altText
                        };
    
Please Sign in or register to post replies

Write your reply to:

Draft