Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi
I'm still working out the kicks of everything and don't really understand everything so it could be something that already is explained somewhere
anyway
i've got a carousel image thing on my site
i want it to grab the images that it uses out of my media library
how can i do this
i was thinking of an xslt but i don't know how to write it
example:<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:msxml="urn:schemas-microsoft-com:xslt" xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:twitter.library="urn:twitter.library" exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets twitter.library "><xsl:output method="xml" omit-xml-declaration="yes"/><xsl:param name="currentPage"/><xsl:template match="/"> <div id="rotating-item-wrapper"> <img class="rotating-item" src="/images/img/photos/1.jpg" /> <img class="rotating-item" src="/images/img/photos/2.jpg" /> <img class="rotating-item" src="/images/img/photos/3.jpg" /> <img class="rotating-item" src="/images/img/photos/4.jpg" /> </div></xsl:template></xsl:stylesheet>
so change the img files so it selects these images from my media library
so i don't have to keep changing the code
Please help me
Hi David,
Here's a very simple way to do it:
Create a property called Media Folder and choose the Media Picker Data Type (It should get the alias mediaFolder).
Now replace the <xsl:template match="/"> ... </xsl:template> in the above XSLT with these three templates:
<xsl:template match="/"> <xsl:variable name="mediaFolderId" select="$currentPage/mediaFolder" /> <!-- Make sure a folder was picked --> <xsl:if test="normalize-space($mediaFolderId)"> <xsl:variable name="mediaFolder" select="umbraco.library:GetMedia($mediaFolderId, true())" /> <!-- Process folder, if it exists --> <xsl:apply-templates select="$mediaFolder[not(error)]" /> </xsl:if> </xsl:template> <xsl:template match="Folder"> <div id="rotating-item-wrapper"> <!-- Process images in folder --> <xsl:apply-templates select="Image" /> </div> </xsl:template> <xsl:template match="Image"> <img class="rotating-item" src="{umbracoFile}" width="{umbracoWidth}" height="{umbracoHeight}" /> </xsl:template>
On the document you can now select a folder in your Media Section and have all the images processed by the single Image template.
/Chriztian
Thanks a million i have been looking and trying to find a solution.exactly what i needed
Greets
David
As usual thumbs up for Chriztian. Awesome.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
I need help with media library
Hi
I'm still working out the kicks of everything and don't really understand everything so it could be something that already is explained somewhere
anyway
i've got a carousel image thing on my site
i want it to grab the images that it uses out of my media library
how can i do this
i was thinking of an xslt but i don't know how to write it
example:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:twitter.library="urn:twitter.library"
exclude-result-prefixes="msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets twitter.library ">
<xsl:output method="xml" omit-xml-declaration="yes"/>
<xsl:param name="currentPage"/>
<xsl:template match="/">
<div id="rotating-item-wrapper">
<img class="rotating-item" src="/images/img/photos/1.jpg" />
<img class="rotating-item" src="/images/img/photos/2.jpg" />
<img class="rotating-item" src="/images/img/photos/3.jpg" />
<img class="rotating-item" src="/images/img/photos/4.jpg" />
</div>
</xsl:template>
</xsl:stylesheet>
so change the img files so it selects these images from my media library
so i don't have to keep changing the code
Please help me
Hi David,
Here's a very simple way to do it:
Create a property called Media Folder and choose the Media Picker Data Type (It should get the alias mediaFolder).
Now replace the <xsl:template match="/"> ... </xsl:template> in the above XSLT with these three templates:
On the document you can now select a folder in your Media Section and have all the images processed by the single Image template.
/Chriztian
Thanks a million i have been looking and trying to find a solution.
exactly what i needed
Greets
David
As usual thumbs up for Chriztian. Awesome.
is working on a reply...