Copied to clipboard

Flag this post as spam?

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


  • John ben 78 posts 293 karma points
    Feb 28, 2017 @ 16:10
    John ben
    0

    Can't get imageurl from image cropped with Archetype

    Hi. I'm having a problem with the get propety of archetype can't get the url of the image cropped here is my code

    enter image description here

    i tried everything but still the same problem item.GetValue

  • Alex Skrypnyk 6175 posts 24186 karma points MVP 8x admin c-trib
    Feb 28, 2017 @ 16:18
    Alex Skrypnyk
    0

    Hi Youness

    Share the code please, can you insert this method like code?

    Thanks

  • Stefano 61 posts 313 karma points c-trib
    Feb 28, 2017 @ 16:30
    Stefano
    0

    I think you should call GetCropUrl on the Url property of the dynamicMediaItem.

    If not I'd suggest you debug through and make sure img is the id of the photo, synamicMediaItem is the media item, etc.

  • John ben 78 posts 293 karma points
    Feb 28, 2017 @ 16:35
    John ben
    0

    yeah but i need first to get the value which is where is the problem

  • John ben 78 posts 293 karma points
    Feb 28, 2017 @ 16:33
    John ben
    0

    enter image description here here is my archetype

    i just want to get the url of the croped image, i used this :

    foreach (ArchetypeFieldsetModel item in featuredItems) { var img = item.GetValue

  • Stefano 61 posts 313 karma points c-trib
    Feb 28, 2017 @ 16:38
    Stefano
    0

    Ok then is it src instead of url in the dynamic, that is a string and calling GetCropUrl on it should work!

  • John ben 78 posts 293 karma points
    Feb 28, 2017 @ 16:41
    John ben
    0

    how can i get the src? because when i use item.GetValue

  • Stefano 61 posts 313 karma points c-trib
    Feb 28, 2017 @ 16:46
    Stefano
    100

    when you get the photo back that's a Json object, of which you need the src, that is the relative path to the image, on that you can then call GetCropUrl. I don't usually use dyanmic but you should be able to just use .src on it to get that value!

  • John ben 78 posts 293 karma points
    Feb 28, 2017 @ 16:50
    John ben
    1

    Thanks worked fine!

Please Sign in or register to post replies

Write your reply to:

Draft