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
Hello,
I'm trying to access the file path of an image programmatically for a custom data type.
I'm tried both document(id) and node(id) neither of which return the 'umbracoFile' property can anyone help?
David
Hi David,
What you can do is try to make a test for the file and from there if its present get the XSLT to write the value. I presume you are using the upload field in your documentType for the image right?
Or you could try something like:
<xsl:for-each select="$currentPage"> <xsl:element name="img"> <xsl:attribute name="src"> <xsl:value-of select="umbraco.library:GetMedia(imageAlias, 'true')/umbracoFile" /> </xsl:attribute> </xsl:element> </xsl:for-each>
I have done a similar type.hope thsi helps you.
Created a MediagalleryItem type and added the following properties to it.
mediatitle(TextString), mediaSource(mediaPicker), mediaDescription(textboxmultiple) .
Here is the XSLT i used.
<xsl:variable name="mediaFolderId" select="number($currentPage/imageFolder)" />
<ul class="imagegallery"> <xsl:for-each select="umbraco.library:GetMedia($MediaId, 1)/GalleryMediaItem">
<img class="rImg"> <xsl:attribute name="src"> <xsl:variable name="tImage" select="mediaSource" /> <xsl:value-of select="umbraco.library:GetMedia($tImage, 'false')/umbracoFile" /> </xsl:attribute>
</img>
</xsl:for-each> </ul>
hope this is what you are looking and helps you
Phani
I was looking for the C# syntax, however I've solve the issue now, but thank you for your help.
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
images (mediaType) as node or document?
Hello,
I'm trying to access the file path of an image programmatically for a custom data type.
I'm tried both document(id) and node(id) neither of which return the 'umbracoFile' property can anyone help?
David
Hi David,
What you can do is try to make a test for the file and from there if its present get the XSLT to write the value. I presume you are using the upload field in your documentType for the image right?
Or you could try something like:
Hi David,
I have done a similar type.hope thsi helps you.
Created a MediagalleryItem type and added the following properties to it.
mediatitle(TextString), mediaSource(mediaPicker), mediaDescription(textboxmultiple) .
Here is the XSLT i used.
<xsl:variable name="mediaFolderId" select="number($currentPage/imageFolder)" />
<ul class="imagegallery">
<xsl:for-each select="umbraco.library:GetMedia($MediaId, 1)/GalleryMediaItem">
<img class="rImg">
<xsl:attribute name="src">
<xsl:variable name="tImage" select="mediaSource" />
<xsl:value-of select="umbraco.library:GetMedia($tImage, 'false')/umbracoFile" />
</xsl:attribute>
</img>
</xsl:for-each>
</ul>
hope this is what you are looking and helps you
Phani
I was looking for the C# syntax, however I've solve the issue now, but thank you for your help.
David
is working on a reply...