I have a milestone doctype that has a media picker dataType property called 'milestoneImage' defined on it.
I am trying to get the image using .GetCropUrl and defining the height and width e.g. .GetCropUrl(200, 200) but not having much luck so im obviously missing something.
Here is my code (milestones are direct children of the current model)
There will obviously be a better way to do this and i believe my understanding is not quite there with it. Maybe you can shorten down what i have done and put it into one statement
Render dynamic image from media using GetCropUrl
Hi All,
I have a milestone doctype that has a media picker dataType property called 'milestoneImage' defined on it.
I am trying to get the image using .GetCropUrl and defining the height and width e.g. .GetCropUrl(200, 200) but not having much luck so im obviously missing something.
Here is my code (milestones are direct children of the current model)
I can see that the dynamic published object is created for image but im unsure how to call the cropUrl to render it as the image source.
Can anyone help/explain please?
Hi Paul
Would this work for you ?
and then in your src attribute
ie I think it could be how you are passing the width and height to the GetCropurl() method:
more info here: https://our.umbraco.org/documentation/getting-started/backoffice/property-editors/built-in-property-editors/image-cropper
Hi paul I would bypass that and just add the querystring on the end of the imageurl myself like this.
Hi Both,
Thanks for your responses regarding this. I will certainly give your suggestions a go and see how i get on :).
In the meantime i got it working using the following 'test' code (poorly names vars)
Outcome of the above code :)
There will obviously be a better way to do this and i believe my understanding is not quite there with it. Maybe you can shorten down what i have done and put it into one statement
Many thanks Paul
is working on a reply...