Copied to clipboard

Flag this post as spam?

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


  • Mark 255 posts 612 karma points
    Jul 14, 2014 @ 12:30
    Mark
    0

    TypedMedia Url causing responsive image issues

    Why do images with the following razor syntax cause inline styles and url's with querystring parameters?

    Output:

    <img src="@(Umbraco.TypedMedia(Model.GetPropertyValue("image")).Url)" alt="" />
    <img style="width: 374px; height:49px;" src="/media/1005/testImg.png?width=374&height=49" alt="testImg.png" rel="1076" />

    I don't want this to happen. I want to see the original image url output into the html that I've specified so that I can handle it responsively (e.g. assign a percentage width in css with a height of auto):

    <img src="/media/1005/testImg.png" alt="" />

    Can I stop this? Ideally as a one off, or even brute force across the entire site.

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jul 14, 2014 @ 12:41
    Jan Skovgaard
    0

    Hi Mark

    What version of v7 are you using? And do you have any 3rd party packages installed?

    /Jan

  • Mark 255 posts 612 karma points
    Jul 14, 2014 @ 12:43
    Mark
    0

    Hi Jan

    Umbraco 7.1.4. I only have Archetype installed. It looks like Tiny MCE is updating this...

  • Mark 255 posts 612 karma points
    Jul 14, 2014 @ 13:08
    Mark
    0

    so it isn't a razor issue, sorry. It's Tiny MCE that generated the html

  • Mark 255 posts 612 karma points
    Jul 14, 2014 @ 13:11
    Mark
    0

    So why does Tiny MCE do that? Can it be stopped? I can understand if it gives the option to change it within the CMS, when adding the image. Maybe it's something to do with image gen?

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Jul 14, 2014 @ 13:36
    Jan Skovgaard
    0

    Hi Mark

    Not sure why the styles are added instead of with="" and height="" attributes... But the alt text is currently being set to the name of the image if none is defined. It's based on a misconception about how the alt attribute should be used.

    You can vote up this issue if you would like it to be changed http://issues.umbraco.org/issue/U4-4734

    Cheers, Jan

  • Mike Chambers 636 posts 1253 karma points c-trib
    Jul 14, 2014 @ 17:59
    Mike Chambers
    0

    A brute force attack,,, could be urlrewrite. ie intercept requests to the media items and rewrite to ignore the querystring.

    This could either be with urlrewriting.net in the core.. or urlrewrite at IIS level.

    http://serverfault.com/questions/372991/iis-url-rewrite-module-query-string-parameters

    another approach could be to parse the richtext editor prior to render on the page. so don't use insert umbraco field.. and have your own macro to parse and remove via regex/xml dom manipulation/xslt... whatever floats your boat.

Please Sign in or register to post replies

Write your reply to:

Draft