Just now I created a image in umbraco 4.5 (from crach) and the node's content xml is stored in different structure in database compared with the one in umbraco v4.0.3 (see the previous post)
If you look at the XML, you will see that the node has a nodeTypeAlias of Image. The synatx to use in Umbraco 4.5 to retreive content from a specific nodeTypeAlias is to use the alias in the path as in /Image.
The syntax to retreive the file path, width, height etc in 4.5 is therefore be:
Thanks! Yeah, you are right. But after upgrading an umbraco 4.0.3 site to umbraco 4.5, the media item's nodeContentXml is still follow the old xml schema. (Please check the first post in the thread).
I am also having this issue, is there a quick way to regenerate the media xml without having to manually resave each media item? I want to use the new schema so setting legacy to true is not an option.
I already put together a dashboard control that loops through all media items and calls save method that fixed the issue. Didnt know about the repbublish.aspx on media i thought it only did content.
Upgrade to umbraco 4.5 but getMedia does not work well
I had some issue after upgrading an umbraco 4.0.3 site to umbaco 4.5
// 1431 is the image id
<textarea>
<xsl:copy-of select="umbraco.library:GetMedia(1431, 'false')" />
</textarea>
Return:
<node id="1431" version="f27b61d4-889d-4ed4-878f-10e9de66fc3e" parentID="1429" level="3" writerID="0" nodeType="1032" template="0" sortOrder="1" createDate="2010-04-16T12:25:17" updateDate="2010-04-16T12:25:17" nodeName="james-duthie" urlName="james-duthie" writerName="Administrator" nodeTypeAlias="Image" path="-1,1138,1429,1431">
<data alias="umbracoFile">/media/15565/james-duthie.jpg</data>
<data alias="umbracoWidth">35</data>
<data alias="umbracoHeight">34</data>
<data alias="umbracoBytes">933</data>
<data alias="umbracoExtension">jpg</data>
</node>
Here the structure of the node is same as the old version v4.0.3 and I am not sure if the new schema will work for it.
Then I tried :
<xsl:for-each select="umbraco.library:GetMedia(1431, 'false')">
<xsl:variable name="theNode" select="."/>
<xsl:variable name="picFile" select="./data[@alias='umbracoFile']"/>
Node : <xsl:value-of select="$theNode"/>
file name -- <xsl:value-of select="$picFile"/>
</xsl:for-each>
Return:
Node : /media/15565/james-duthie.jpg3534933jpg
file name -- <empty>
I also tried:
<xsl:for-each select="umbraco.library:GetMedia(1431, 'false')/Image">
<xsl:variable name="theNode" select="."/>
<xsl:variable name="picFile" select="./data[@alias='umbracoFile']"/>
Node : <xsl:value-of select="$theNode"/>
file name -- <xsl:value-of select="$picFile"/>
</xsl:for-each>
Return: <empty/nothing>
From: http://our.umbraco.org/forum/core/41-feedback/10128-umbracoFile-property-returns-empty?p=0#comment37120
I tried this one:
<img src="{umbraco.library:GetMedia(1431, 'false')/Image/umbracoFile}"/>
But returned nothing.
Thanks in advance.
Just now I created a image in umbraco 4.5 (from crach) and the node's content xml is stored in different structure in database compared with the one in umbraco v4.0.3 (see the previous post)
<Image id="1117" version="cbfbf7b0-b3a7-498b-b68f-7714694ae7f0" parentID="-1" level="1" writerID="0" nodeType="1032" template="0" sortOrder="62" createDate="2010-06-29T10:34:30" updateDate="2010-06-29T10:34:31" nodeName="test" urlName="test" writerName="Administrator" nodeTypeAlias="Image" path="-1,1117">
<umbracoFile>/media/471/72 and 84.png<umbracoFile>
<umbracoWidth>1156 <umbracoWidth>
<umbracoHeight>594 <umbracoHeight>
<umbracoBytes>76447 <umbracoBytes>
<umbracoExtension>png <umbracoExtension>
I am not sure if the getMedia in umbarco 4.5 works in different structures of node content xml.
Thanks in advance!
I also tried to resave the media item and create new media itme but no luck.
If you look at the XML, you will see that the node has a nodeTypeAlias of Image. The synatx to use in Umbraco 4.5 to retreive content from a specific nodeTypeAlias is to use the alias in the path as in /Image.
The syntax to retreive the file path, width, height etc in 4.5 is therefore be:
umbraco.library:GetMedia(1431, 'false')/Image/umbracoFile
umbraco.library:GetMedia(1431, 'false')/Image/umbracoWidth
etc
Thanks to Lee Messenger for clarifying this during CodeGarden
HTH
Tom
Hi quixltd,
Thanks! Yeah, you are right. But after upgrading an umbraco 4.0.3 site to umbraco 4.5, the media item's nodeContentXml is still follow the old xml schema. (Please check the first post in the thread).
Regards,
Peng
Now I found that I need to <UseLegacyXmlSchema>false</UseLegacyXmlSchema> in umbracoSettings.config.
After publishing the whole site, I got the content nodes stored in database with new schema.
However the media items have to be manually saved up again.
Guys,
I am also having this issue, is there a quick way to regenerate the media xml without having to manually resave each media item? I want to use the new schema so setting legacy to true is not an option.
Regards
Ismail
You can do a publish of all items (including media) using this:
>Tommy
Tommy,
I already put together a dashboard control that loops through all media items and calls save method that fixed the issue. Didnt know about the repbublish.aspx on media i thought it only did content.
Regards
Ismail
Thanks, Tommy, the republish.aspx?xml=true did the trick for me. This should be added to the upgrade Wiki!
I just updated this guide on the wiki:
http://our.umbraco.org/wiki/install-and-setup/upgrading-an-umbraco-installation
is working on a reply...