Copied to clipboard

Flag this post as spam?

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


  • Bora B 32 posts 124 karma points
    Feb 22, 2015 @ 18:50
    Bora B
    0

    get crop Url from next or previous node

    Hi,

    I need some help with Image Cropper

    I'm using 7.2.2 with mvc and trying to get a cropped image from the next or previous node of the current node..

    I'm using the following but I don't gen an error but also cannot get the URL

    How can do that?

    Thanks for the help

     @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
        var oncekiHaber = CurrentPage.Previous();
        var sonrakiHaber = CurrentPage.Next();
    }
    
        <div class="section section-no-margin-bottom row entries bg-primary">
            @if (oncekiHaber != null) {
    
              <article class="entry style-grid style-hero hero-nav type-post col-xs-6 col-sm-6"> <a href="@oncekiHaber.Url">
                <header class="entry-header">
                  <p class="small">ÖNCEKİ HABER</p>
                  <h3 class="entry-title">@oncekiHaber.haberBaslik</h3>
                </header>
                <figure class="entry-thumbnail">
                  <div class="overlay overlay-primary"></div>
                    @if (oncekiHaber.HasValue("haberResmi"))
                    {
                  <img src="@oncekiHaber.GetCropUrl("haberResmi", "oncekiSonraki")"  width="480" height="280" alt="">
                    }  
                    </figure>
                </a> </article>
            }
    
  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Feb 22, 2015 @ 23:28
    Alex Skrypnyk
    0

    Hi Bora,

    You can get croppedUrl of media item, not siblings nodes.

    So you have to get image before.

    Can you show your docTypes ? 

    Thanks

  • Sören Deger 733 posts 2844 karma points c-trib
    Feb 23, 2015 @ 06:09
    Sören Deger
    0

    Hi Bora,

    Is your image cropper in docType of siblings nodes or in a related media node?

     

    Best,

    Sören

  • Bora B 32 posts 124 karma points
    Feb 23, 2015 @ 09:46
    Bora B
    0

    Hi,

    the docType of the document is the same as the siblings of this document. All of them have the docType "genelIcerik"

    my generic properties in this docType are on the below picture

    Is it possible that you give me code example to better understand that.. Many Thanks.

    my generic properties in this docType

  • Sören Deger 733 posts 2844 karma points c-trib
    Feb 23, 2015 @ 09:56
    Sören Deger
    0

    Hi Bora,

    Is your custom type "Haber Crop Image" an default "Image Cropper" datatype? 

     

    Best, 

    Sören

  • Bora B 32 posts 124 karma points
    Feb 23, 2015 @ 10:18
    Bora B
    0

    Yes that's true. It's working without problems when I use the same code to get from the same page..

  • Sören Deger 733 posts 2844 karma points c-trib
    Feb 23, 2015 @ 10:39
    Sören Deger
    0

    But then it would actually work.

    It could also be another cause:

    If you are in the first node there is no previous node and if you are in the last node there is no next node. Please check if you get the error only on first and last node. 

     

    Best,

    Sören

     

  • Bora B 32 posts 124 karma points
    Feb 23, 2015 @ 11:28
    Bora B
    0

    hi again. No it is not the first or the last one. I cheked that and I also get some other text data from the siblings and they're running just fine.

    the following is also not working. I'm trying to get crop image from the children of a page but no luck. and I'm sure that there is a picture.

    @{ var selection = CurrentPage.Children.Where("Visible").OrderBy("CreateDate desc"); }
    
            <div class="entries">
                @foreach (var item in selection)
                {
            <article class="entry style-media media type-post">
            <figure class="media-object pull-left entry-thumbnail hidden-xs">
                <img src="@item.GetCropUrl("haberResmi", "digerHaberler")" width="230" height="230" class="" alt=""> </figure>
            <div class="media-body">
              <header class="entry-header">
                <h3 class="entry-title"> <a href="@item.Url" rel="bookmark">@item.Name</a> </h3>
                <div class="entry-meta"> <span class="entry-date">
                  <time datetime="2013-07-04T23:26:34+00:00">@item.UpdateDate</time>
                  </span> </div>
              </header>
              <p>@item.haberSpotu <a href="@item.Url" class="more-link">Okumaya Devam Et<i class="icon icon-long-arrow-right"></i></a> </p>
            </div>
          </article>
                }
    
  • Sören Deger 733 posts 2844 karma points c-trib
    Feb 23, 2015 @ 11:51
    Sören Deger
    0

    Hi Bora,

    please comment out the line with the img tag. Just to make sure the issue really is up to this line.

    If it works without this line and if you get any other property values of this node please check the document and datatype settings again. Have you already the right data type in the related document type? Maybe you have a typo in an alias? Is the name of your crop exactly (case-sensitive)? Republish all nodes again.

    You can also look into the /App_Data/umbraco.config file. Is the correct data for your nodes inside? Do you missing anything?

     

    Best,

    Sören

  • Bora B 32 posts 124 karma points
    Feb 24, 2015 @ 11:29
    Bora B
    0

    Hi Sören,

    you're right it was a letter case problem that I missed @item.GetCropUrl("haberResmi", "digerHaberler") should be @item.GetCropUrl("haberResmi", "DigerHaberler")

    Thank You very much for your help

  • Sören Deger 733 posts 2844 karma points c-trib
    Feb 24, 2015 @ 19:42
    Sören Deger
    0

    Hi Bora,

    nice that I could help you :-) Can you mark my answer above as the solution?
     

    Best,

    Sören

  • Bora B 32 posts 124 karma points
    Feb 24, 2015 @ 23:02
    Bora B
    0

    Hi Again Sören,

    I have one more problem if you can help me

    this one works:

    <img src='@node.GetCropUrl("haberResmi", "DigerHaberler")' width="480" height="280" alt="">
    

    but this custom crop option does not work and does not give any error too

    <img src='@node.GetCropUrl(PropertyAlias:"haberResmi", width:480 ,height:280)' width="480" height="280" alt="">
    

    How is that possible?

    Thx Again

Please Sign in or register to post replies

Write your reply to:

Draft