Hi! This is a simple one for you gurus I think :) I need to in the doctype choose an image from the medialibrary, and then assin an internal link to it. I´ve used Mediapicker for the image and the content picker for the link.
I just can´t get the contenpicker to assign the link?
surely there is... i often have a property on page called pageImage... i use an xslt macro to render that image to the page, usually in a template, but let's look at some macro code that could do what you want. Below is a complete xslt that i have used that does a couple of things...
1. if the user pics a media folder, it lists all the images from that folder
2. if only one image is picked, it renders it to screen and includes the link element if a link is selected...
now, caveat here is that i have the content picker on the media node itself, but we can address that below the code... so here goes.
Insert image from medialibrary & assign internal link
Hi!
This is a simple one for you gurus I think :)
I need to in the doctype choose an image from the medialibrary, and then assin an internal link to it.
I´ve used Mediapicker for the image and the content picker for the link.
I just can´t get the contenpicker to assign the link?
This is what I want:
This is how far i got:it:
Any ideas? :)
Hi,
it could work if you use pageID in the field attribute and then access your properties with $currentPage/data[@alias='YOUR_ALIAS'].
Don't know if this works if highlighted my changes:
Hope this helps
Toby
Hi
I can´t get this to work :(
The "aliases" of the
Mediapicker is: banner_1_bild
&
content picker : banner_1_lank
The idea is that you pick an image from the media library and when it´s clicked i want to go to an internal url.
Is there any other way to achieve this?
surely there is... i often have a property on page called pageImage... i use an xslt macro to render that image to the page, usually in a template, but let's look at some macro code that could do what you want. Below is a complete xslt that i have used that does a couple of things...
1. if the user pics a media folder, it lists all the images from that folder
2. if only one image is picked, it renders it to screen and includes the link element if a link is selected...
now, caveat here is that i have the content picker on the media node itself, but we can address that below the code... so here goes.
So, let's look at the linking stuff...
I am setting a variablebased on the media item... you would simply set it based on $currentPage/data[@alias='picLink']
then you would use umbraco.library:NiceUrl($imageLink) to generate your link variable like this...
Please NOTE my code uses the most EXCELLENT IMAGEGEN to size the images....
hope that helps.
is working on a reply...