Copied to clipboard

Flag this post as spam?

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


  • Bjarne Fyrstenborg 1155 posts 3350 karma points MVP 4x c-trib
    Jun 03, 2015 @ 23:41
    Bjarne Fyrstenborg
    0

    GetResponsiveCropUrl returns different src after Umbraco upgrade

    Hi..

    I have upgraded Umbraco from 7.2.4 to 7.2.6

    I have Slimsy 1.1.5 installed - both before and now, but somehow the GetResponsiveCropUrl method in Slimsy seems to return a different image src than before.

    This is the code I have in my razor view, which is the same as before:

    <img src="@Model.Content.GetResponsiveCropUrl("normal", "profilePhoto")" alt="" class="profile-photo" />

    Before, in 7.2.4 it returned this image and src:

    /media/1001/_mg_9991.jpg?center=0.49333333333333335,0.5275&mode=crop&quality=90&width=320&heightratio=1&format=jpg&slimmage=true&rnd=130742062280000000

    now after upgrade to Umbraco 7.2.6 the src is and the image is different:

    /media/1001/_mg_9991.jpg?crop=0.093726494922903414,0.066769109627679624,0.078894791274914708,0.31269685502068395&cropmode=percentage&quality=90&width=320&heightratio=1&format=jpg&slimmage=true&rnd=130778444240000000

    I wonder why it is different now? ..  before the src url had mode=crop and center=0.49333333333333335,0.5275 .. now these parameters are not added, but instead it has cropmode=percentage .. any idea why this happens?

    The first image is from live and the second is from development - so the focal points might not have exactly same positions, but the are located in the center and the images uploaded are the same.

    /Bjarne

  • Jeavon Leopold 3005 posts 13193 karma points MVP 7x admin c-trib
    Jun 04, 2015 @ 00:13
    Jeavon Leopold
    0

    Hi Bjarne,

    I think there are two things going on here, the first one is that while you are are requesting a predefined crop, in your first example this hasn't been set so it's falling back to the focal point, in the second example, the predefined crop has been set. The second thing is that it seems that your upgrade to Umbraco v7.2.6 has deregistered ImageProcessor from your Web.Config.

    Could you try requesting /media/1001/_mg_9991.jpg?width=100 and see if it returns a resized image or not...?

    If not could you post your web.config here (removing any passwords)?

    Jeavon

  • Bjarne Fyrstenborg 1155 posts 3350 karma points MVP 4x c-trib
    Jun 04, 2015 @ 00:52
    Bjarne Fyrstenborg
    100

    Hi Jeavon

    The ImageProcessor is registered in web.config .. but I just noticed that I saw this when I entered "edit mode" for the defined crop (220x220px, alias=normal). (7.2.6)

    compared to "edit mode" live (7.2.4).

    Actually the "edit mode" (7.2.4) here didn't seem to match exactly how the first view was:

    However after dragging the image in "edit mode" a bit to the left and save, the "edit mode" seems to be updated (7.2.4). It might be because it not has been re-saved from previously upgrades.

     

    Back to the development (7.2.6) ... after I dragged scaled and dragged the image in "edit mode" and saving it - it seems to be updated:

    /media/1001/_mg_9991.jpg?crop=0.154,0,0.0960000000000018,0.0000000000000021962230014403&cropmode=percentage&quality=90&width=320&heightratio=1&format=jpg&slimmage=true&rnd=130778512530000000

    It seems that something (maybe in the cache?) not was updated and the defined crop needed to be dragged a bit and saved to be updated - it was not enough just to save & publish the page in first place. I needed to "touch" the defined crop too.

    and /media/1001/_mg_9991.jpg?width=100 works fine too.. so I just think this was because the crop wasn't updated - but I think it should when you publish the page an the preview of the crop seemed to be right.

    I also noticed that the zoom-slider doesn't seem to update the image-crop preview properly, when you e.g. drag it to the end point and back to the start point in the slider - sometimes it has a bit delay and first update the crop-preview after click on the white background or start dragging the image. You should be able to reproduce it if the drag the slider fast to end point and back to start point, where you might still see the zoomed image.

    /Bjarne

  • Anders Burla Johansen 2560 posts 8256 karma points
    Sep 18, 2015 @ 09:02
    Anders Burla Johansen
    0

    @Jeavon - have a related question. Where does the cropmode=percentage come from? I don't see it in the Umrbaco code for getting a CropUrl in 7.2.8 https://github.com/umbraco/Umbraco-CMS/blob/7.2.8/src/Umbraco.Web/ImageCropperTemplateExtensions.cs

    And I don't see it working if you parse in a new cropmode - it is still percentage. Do you have any idea of this??

    Kind regards Anders

  • Jeavon Leopold 3005 posts 13193 karma points MVP 7x admin c-trib
    Sep 18, 2015 @ 09:08
    Jeavon Leopold
    0

    Hi Anders,

    It comes from here https://github.com/umbraco/Umbraco-CMS/blob/2029bef6eb8b2a831f55349015dae8e5c902dfb3/src/Umbraco.Web/ImageCropperBaseExtensions.cs#L97

    I'm not sure I understand what you mean by parsing in a new cropmode, could you post your parameters?

    Jeavon

  • Anders Burla Johansen 2560 posts 8256 karma points
    Sep 18, 2015 @ 09:13
    Anders Burla Johansen
    0

    Ahh - THANKS!

Please Sign in or register to post replies

Write your reply to:

Draft