Copied to clipboard

Flag this post as spam?

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


  • Yasir Butt 161 posts 371 karma points
    Nov 21, 2015 @ 00:38
    Yasir Butt
    0

    Getting error Divide by zero after installing Slimsy

    Hi,

    I have installed latest version of slimsy 1.1. 6 on my Umbraco 7.3.1, Even i have also tried slimsy 1.1.5 as well

    when i write the GetResponsiveImageUrl on my image tag then getting Exception Dividebyzero on TypedMedia. if i dont use this one instead use GetCropUrl then works fine.

    See the below image. Any help will be appreciated!

    enter image description here

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Nov 21, 2015 @ 20:25
    Jeavon Leopold
    0

    Hi there, could you please post your Razor with the GetResponsiveImageUrl method? Jeavon

  • Yasir Butt 161 posts 371 karma points
    Nov 21, 2015 @ 21:25
    Yasir Butt
    0

    Hi,

    Below is my partial's code

    @using Slimsy
    

    @using Umbraco.Web @using Umbraco.Web.Models @model Promenaden.Web.Models.NewsSectionModel @{

        var umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
        var newsContent = umbracoHelper.TypedContent(Model.NewsId);
        if (newsContent.HasValue("newsImage"))
        {
    
            var img = umbracoHelper.TypedMedia(newsContent.GetPropertyValue<int>("newsImage"));
    
            <a href="@newsContent.Url">
    
        <div class="shadow-overlay"></div>
    
    
            <div class="bg-image zoom-images scrollflow -slide-top image-wrapper scroll-block">
                @*<img src="@img.GetCropUrl(Model.ImageWidth, imageCropMode: ImageCropMode.Crop)" alt="@Model.Title"/>*@
                <img src="@img.GetResponsiveImageUrl(Model.ImageWidth,200)" alt="@Model.Title" />
            </div>
            <div class="caption-wrapper">
                <h1>@Model.Title</h1>
                <a class="read-more" href="@newsContent.Url">Read more</a>
            </div>
        </a>
    }
    

    }

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Nov 23, 2015 @ 16:42
    Jeavon Leopold
    0

    The problem here is that Model.ImageWidth from your custom model is either 0 or null and so the ratio which is required for the image to be responsive cannot be worked out hence the exception.

  • Yasir Butt 161 posts 371 karma points
    Nov 22, 2015 @ 22:44
    Yasir Butt
    0

    Hi Jeavon,

    Quick help will be appreciated. Everything is ready in this project but responsive image have to fix.

    It is very strange that i am getting error on Typedmedia method instead of ResponsiveImage method.

    Yasir

  • Yasir Butt 161 posts 371 karma points
    Nov 22, 2015 @ 23:21
    Yasir Butt
    0

    Hi,

    I have just notice one thing that when i installed the slimsy then it gave me error of HtmlAgility 1.4.6 while Umbraco 7.3.1 has version 1.4.9.0

    see the scree below

    enter image description here

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Nov 23, 2015 @ 16:32
    Jeavon Leopold
    0

    Slimsy v1.1.6 doesn't have this issue, you should update!

  • Yasir Butt 161 posts 371 karma points
    Nov 25, 2015 @ 18:03
    Yasir Butt
    0

    Hi,

    Thanks Jevon! i have checked my code which was calculating initial width having problem and given value 0.

    so every thing is working fine.

    i have a new question that how can i can override slimsy parameter with mine

    like i see that slimsy generate querystring with mode=pad but i want to override it with mine like mode=crop

    How can i do it?

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Nov 25, 2015 @ 18:06
    Jeavon Leopold
    0

    Slimsy will use mode=crop as long as you are using it with a Image Cropper data type?

  • Yasir Butt 161 posts 371 karma points
    Nov 25, 2015 @ 18:18
    Yasir Butt
    0

    Do you have 10 min to have a chat on skype?

    I am scratching my head since 2-3 hours with slimsy and images.

    Please help me :)

    My skype id is aizalogics

  • Yasir Butt 161 posts 371 karma points
    Nov 25, 2015 @ 18:21
    Yasir Butt
    0

    I cant understand that why is slimsy not getting correct height and width from my section.

    can you please help me Jeavon?

  • Jeavon Leopold 3074 posts 13632 karma points MVP 11x admin c-trib
    Nov 25, 2015 @ 18:30
    Jeavon Leopold
    0

    Are you on the Umbraco Community Slack?

    Sounds like your images are not being correctly sized by css, make sure you read the documentation for Slimmage here

  • Yasir Butt 161 posts 371 karma points
    Nov 25, 2015 @ 18:35
    Yasir Butt
    0

    Why slimsy is resizing the image instead cropping?

    I have image in image cropper without any crop defined and image size is 2048*1224 and focal point is centered.

    my section size is 1228 * 850 but slimsy is resized the image to 1280 * 789.

  • Yasir Butt 161 posts 371 karma points
    Nov 25, 2015 @ 18:37
    Yasir Butt
    0

    No i am not on Umbraco community slack

  • Yasir Butt 161 posts 371 karma points
    Nov 25, 2015 @ 18:38
    Yasir Butt
    0

    Do you have some minutes to look at my problem over skype?

Please Sign in or register to post replies

Write your reply to:

Draft