Copied to clipboard

Flag this post as spam?

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


  • Claushingebjerg 939 posts 2574 karma points
    Jun 17, 2015 @ 09:16
    Claushingebjerg
    0

    Image cropper acting up

    I jsut installed a clean 7.2.6 and have trouble with the image cropper... Both alone and with slimsy it wont show any image. Though when inspecting the source, the img tags are kind of correctly populated...

    var featureImage = Umbraco.Media(CurrentPage.imageID);
     <img src="@featureImage.GetResponsiveImageUrl(1600, 500)" alt="top" />
    

    Returns the follwoing in the markup

    <img data-src="/media/1003/sts_fireworks.jpg?anchor=center&amp;mode=crop&amp;quality=90&amp;width=1600&amp;heightratio=0.3125&amp;format=jpg&amp;slimmage=true&amp;rnd=130790129870000000" alt="top" data-slimmage="true">
    

    But doesnt show any image.... Doing the following:

     var m = Umbraco.Media(CurrentPage.imageID);
    <img src="@m.Url" alt="@m.UrlName" />
    

    Shows the image... But it seems to be a different ID. The id of the image in the media library is 1126... not 1003?!?

    <img src="/media/1003/sts_fireworks.jpg" alt="sts_fireworksjpg">
    

    Looking in the log, theres a troubling entry...

    ERROR Umbraco.Core.Dynamics.DynamicInstanceHelper - [T7/D2] An error occurred finding and executing extension method "GetCropUrl" for type "Umbraco.Web.Models.DynamicPublishedContent". Types searched for extension methods were Umbraco.Web.Models.DynamicPublishedContent.
    System.MissingMethodException: Method 'Umbraco.Web.Models.DynamicPublishedContent.GetCropUrl' not found.
       at Umbraco.Core.Dynamics.DynamicInstanceHelper.FindAndExecuteExtensionMethod[T](IRuntimeCacheProvider runtimeCache, T thisObject, Object[] args, String name, IEnumerable`1 findMethodsOnTypes)
       at Umbraco.Core.Dynamics.DynamicInstanceHelper.TryInvokeMember[T](IRuntimeCacheProvider runtimeCache, T thisObject, InvokeMemberBinder binder, Object[] args, IEnumerable`1 findExtensionMethodsOnTypes)
    

    Any ideas?

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Jun 17, 2015 @ 09:21
    Jeavon Leopold
    0

    Troubling indeed! When you say different ID what do you mean exactly?

  • Claushingebjerg 939 posts 2574 karma points
    Jun 17, 2015 @ 09:31
    Claushingebjerg
    0

    I was confused by the folder id in the image url. It was "1003" The image id is correctly "1126" all over, so that good.

    But cropping is still defunct...

  • Claushingebjerg 939 posts 2574 karma points
    Jun 17, 2015 @ 09:34
    Claushingebjerg
    0

    If i copy the image crop url

    http://www.mydomain.com/media/1003/sts_fireworks.jpg?anchor=center&amp;mode=crop&amp;quality=90&amp;width=160&amp;heightratio=0.3125
    

    And paste it into the browser directly i get a correctly cropped image...

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Jun 17, 2015 @ 09:37
    Jeavon Leopold
    0

    Strange, then it should be working, any JS errors from Slimmage?

  • Claushingebjerg 939 posts 2574 karma points
    Jun 17, 2015 @ 09:59
    Claushingebjerg
    0

    No js errors whatsoever, but actually

    <img src='@CurrentPage.GetCropUrl(propertyAlias: "imageID", height:300, width:400)' alt="Cropped image should be here"/>
    

    returns blank...

    <img src="" alt="Cropped image should be here">
    

    Check it out live: (removed)

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Jun 17, 2015 @ 10:05
    Jeavon Leopold
    0

    Ooops, could you add

    <script type="text/javascript">
            window.slimmage = { verbose: true};
        </script>
    

    before slimmage.js

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Jun 17, 2015 @ 10:15
    Jeavon Leopold
    0

    verbose: true

  • Claushingebjerg 939 posts 2574 karma points
    Jun 17, 2015 @ 10:29
    Claushingebjerg
    0

    enter image description here

    Done.

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Jun 17, 2015 @ 10:59
    Jeavon Leopold
    0

    Ok, so the Slimsy one is something I hit with Slimmage v0.4 (but of course I forgot), you need to have a max-width on the image.

    Try adding this

    <style>
        img {max-width:500px}
    </style>
    

    My original issue is documented here

    Now onto that dynamic extension method issue....

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Jun 17, 2015 @ 11:00
    Jeavon Leopold
    0

    Darn it, I even wrote a note here I completely forgot!

  • Claushingebjerg 939 posts 2574 karma points
    Jun 17, 2015 @ 11:01
    Claushingebjerg
    0

    BINGO! And as written in the docs, if i had cared to scroll to the bottom...

    "Slimsy v1.1.4 includes the update to Slimmage.js v0.4.1 - for this version of Slimmage you must ensure your images have the max-width:100% css property."

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Jun 17, 2015 @ 11:09
    Jeavon Leopold
    0

    :) Still worried by your second one about the dynamic extension method, will be checking that shortly.

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Jun 17, 2015 @ 14:14
    Jeavon Leopold
    0

    I haven't been able to reproduce your worrying DynamicInstanceHelper error...

    If you can reproduce it, please let me know.

  • Claushingebjerg 939 posts 2574 karma points
    Jun 17, 2015 @ 14:25
    Claushingebjerg
    0

    Tried with

    <img src='@CurrentPage.GetCropUrl("imageID", "banner")' />
    

    It returns

    <img src="1126?mode=pad&amp;rnd=130790213720000000">
    
  • Claushingebjerg 939 posts 2574 karma points
    Jun 17, 2015 @ 14:28
    Claushingebjerg
    0
    <img src='@Umbraco.Media(1126).GetCropUrl("banner")' />
    

    Works... And so does

    <img src='@Umbraco.Media(CurrentPage.imageID).GetCropUrl("banner")' />
    
  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Jun 17, 2015 @ 14:57
    Jeavon Leopold
    100

    Ok, for @CurrentPage.GetCropUrl("imageID", "banner") you would need to have a cropper on your content doc type with a property alias of imageID, I don't think that's correct, so it's falling back to the string extension method...

  • Claushingebjerg 939 posts 2574 karma points
    Jun 17, 2015 @ 15:18
    Claushingebjerg
    0

    Ahhh, no i have it as the upload data type on the image media type.

    But thats actually a bit unclear from the docs on

    https://our.umbraco.org/DOCUMENTATION/Using-Umbraco/Backoffice-Overview/Property-Editors/Built-in-Property-Editors-v7/Image-Cropper

  • Jeavon Leopold 3074 posts 13631 karma points MVP 11x admin c-trib
    Jun 18, 2015 @ 06:56
    Jeavon Leopold
    0

    You're right, time for a little edit :) I also use the cropper on media items rather than content

Please Sign in or register to post replies

Write your reply to:

Draft