Content tab uploading an image with content id as name
I have a "news" type category that has "news" type content items. I have a tab setup for content item to upload an image. I'm wanting to make the upload image tab automatically name the image to the content's id so that I can then use that name in the category landing template to build a list of "news" items using only that image. This will aid in workflow in creating the "news" items so that the user need only upload the image in the tab and the "news" category landing page will then just build the "news" items using that image.
Not sure if this is what you're referring to. Would'nt it just not be easier doing this in your actual renderings? By requesting the news category image property using someting like newsNode.Parent.Image ?
Thanks for the reply @Mathijs. It's more the initial upload step I'm having trouble with. I don't have a problem accessing an image from the node. So I currently have a Tab for my content item. In that Tab there is a single image upload button/input. When I upload it, it saves it as it's original name. Id like for it to upload and then automatically change it's name to the id or something that can be easily referenced within the xslt. For instance, newsItem1 is created, I go to the Upload Teaser Image tab then upload the image. The image is uploaded and name as teaser_1234.jpg where "1234" is the newsItem1 id. In the XSLT file for the landing page in the for loop for building the available newsitems I can reference the img, for each newsitem, src="teaser_{...@id}.jpg" or some variation of that anyway.
I might be misunderstanding, but you can just reference the upload field in your XSLT and this will give you the file path of the image you uploaded. I don't see why you would need to name it anything in particular, since you can just get the path like so:
Sounds like what I'm aiming for. So what I have so far is...
Umbraco 4.7.0
In the News Item page, i added a new tab called Teaser Image
Then added a Generic property tab "teaserImage" Type: Upload
Then in my news item I've gone to the tab and uploaded an image.
In my XLST that's located on the news item template, how do I reference that image path? (if I can figure that part out, I can then add this logic to the landing page for my looping of all the news items.
If you are trying to get the image from the News Item page itself, you need to prefix it with $currentPage to specify to grab the value from the current node.
Ex: <img src="{$currentPage/teaserImage}"/>
But when you are in the for-each loop on your news landing page, it assumes you are grabbing the value from the current node in the for-each loop, so you shouldn't prefix it there, ie
<xsl:for each select.....> <img src="{$currentPage/teaserImage}" /> </xsl:for-each>
Content tab uploading an image with content id as name
I have a "news" type category that has "news" type content items. I have a tab setup for content item to upload an image. I'm wanting to make the upload image tab automatically name the image to the content's id so that I can then use that name in the category landing template to build a list of "news" items using only that image. This will aid in workflow in creating the "news" items so that the user need only upload the image in the tab and the "news" category landing page will then just build the "news" items using that image.
Not sure if this is what you're referring to. Would'nt it just not be easier doing this in your actual renderings? By requesting the news category image property using someting like newsNode.Parent.Image ?
Thanks for the reply @Mathijs. It's more the initial upload step I'm having trouble with. I don't have a problem accessing an image from the node. So I currently have a Tab for my content item. In that Tab there is a single image upload button/input. When I upload it, it saves it as it's original name. Id like for it to upload and then automatically change it's name to the id or something that can be easily referenced within the xslt. For instance, newsItem1 is created, I go to the Upload Teaser Image tab then upload the image. The image is uploaded and name as teaser_1234.jpg where "1234" is the newsItem1 id. In the XSLT file for the landing page in the for loop for building the available newsitems I can reference the img, for each newsitem, src="teaser_{...@id}.jpg" or some variation of that anyway.
Hi Robert,
I might be misunderstanding, but you can just reference the upload field in your XSLT and this will give you the file path of the image you uploaded. I don't see why you would need to name it anything in particular, since you can just get the path like so:
<img src="{yourUploadFieldAliasHere}" />
Let me know if I'm misunderstanding :)
-Tom
Sounds like what I'm aiming for. So what I have so far is...
I've tried using
<img src="{teaserImage}" />
AND
<img src="teaserImage" />
AND
<xsl:element name="img">
<xsl:attribute name="src">
<xsl:value-of select="teaserImage"/>
</xsl:attribute>
</xsl:element>
AND
<xsl:variable name="media" select="umbraco.library:GetMedia($currentPage/teaserImage, 0)" />
<img src="{$media/umbracoFile}" alt="" />
Thanks
Hi,
If you are trying to get the image from the News Item page itself, you need to prefix it with $currentPage to specify to grab the value from the current node.
Ex: <img src="{$currentPage/teaserImage}"/>
But when you are in the for-each loop on your news landing page, it assumes you are grabbing the value from the current node in the for-each loop, so you shouldn't prefix it there, ie
<xsl:for each select.....>
<img src="{$currentPage/teaserImage}" />
</xsl:for-each>
Hope this helps,
Tom
Awesome! That got it.
Thanks
is working on a reply...