I already went through lots of topics talking about uploading and using images and found and all of them has usefull information however I still can't figure out a good way of doing what i need:
I'm importing a HTML layout to umbraco. Here is how the designer added the logo:
- The end user have to be able to change the logo using the umbraco interface. - I'd like to keep things as close as possible to the original design, so when he provide an update/fix it will be easier for me to import the update.
If I upload the logo under "Media" and add a referene to it on the css, something like "media/2/logo.png" I still have problems because i believe the number "2" is an Id and will change if the user remove and add the logo again. Also, I won't be able to use the same css on other websites.
I noticed people talking about create a "images" folder under the root folder but i believe they are talking about the ftp client option right? Because i don't see an option to create a folder under the "Content" node.
I'm very sure it's something really easy but sisnce I'm new to how things work on Umbraco I'm probably missing something. Thanks in advance.
I'm not an expert in Umbraco so I'm sure there may be a very efficient way of doing this.
First of all, I am assuming by "umbraco interface" you mean the backend? If that's the case, how about creating a macro with a media picker property, and using inline style for that <h1> element? Then you can insert the macro in the middle of the inline style and select the appropriate media item.
Once a Media node has been created you don't really have to remove and add the logo again. You can edit the node, remove the file, and upload a new one, all still referenced by the same media node. The macro should render the correct path to the file.
DISCLAIMER: I haven't actually tried this - it's just something I would give a go to see if it works. I hope I haven't misunderstood your requirements.
Thanks for the info. Just to make things more clear, i wan't the end user to change the logo via a property available under the home page, not through a rich text editor.
Based on your idea, here is what i did:
I created a macro with a parameter called "LogoId". The parameter type is "text" (i didn't find a media picker type on the list). Here is what the macro looks like
After that, i created a property on the document type (MasterPage) called "LogoSite" with type set as "Media Picker". This property will allow the end user to select/change the logo on a specific tab of the home page. A added the macro to the master page template and passed the page property as a parameter, like this:
The only thing i don't get here is why it's rendering "logo.png270509912png" instead of "logo.png". Is a browser supposed to recognize it as an image? Because Firefox isn't.
That's how I'd do it Danny, although I'm not a big fan of inline styles.
CodeMaster: I think what you could probably use is a crash course in how Umbraco works, for this problem, you could go and read the excellent blog post of Lee Kelleher on how to get media items in XSLT. But I can really recommend you have a look at umbraco.tv (a month's subscription is only €19 and you can cancel after the first month).
However, it's still not showing the logo. I believe it could be a path problem but, if i try the url bellow, the logo is there. http://mydomain.com/media/275/logo.png
Ah... I understand. You don't need parameters on the macro - just use the MediaPicker property on the DocumentType. In your selectors I think you need to use
I hope I've understood you correctly now. This way logourl should give you the right URL to the image file. This is all assuming you're not using the new XML in 4.1 :o)
Allow users to change the website logo
Hi;
I already went through lots of topics talking about uploading and using images and found and all of them has usefull information however I still can't figure out a good way of doing what i need:
I'm importing a HTML layout to umbraco.
Here is how the designer added the logo:
<h1 id="logo" class="fl"></h1>
And here is the css class:
#logo {
width: 270px;
height: 50px;
background: url(../images/logo.png) no-repeat;
}
Now the challenge:
- The end user have to be able to change the logo using the umbraco interface.
- I'd like to keep things as close as possible to the original design, so when he provide an update/fix it will be easier for me to import the update.
If I upload the logo under "Media" and add a referene to it on the css, something like "media/2/logo.png" I still have problems because i believe the number "2" is an Id and will change if the user remove and add the logo again. Also, I won't be able to use the same css on other websites.
I noticed people talking about create a "images" folder under the root folder but i believe they are talking about the ftp client option right? Because i don't see an option to create a folder under the "Content" node.
I'm very sure it's something really easy but sisnce I'm new to how things work on Umbraco I'm probably missing something.
Thanks in advance.
I'm not an expert in Umbraco so I'm sure there may be a very efficient way of doing this.
First of all, I am assuming by "umbraco interface" you mean the backend? If that's the case, how about creating a macro with a media picker property, and using inline style for that <h1> element? Then you can insert the macro in the middle of the inline style and select the appropriate media item.
Once a Media node has been created you don't really have to remove and add the logo again. You can edit the node, remove the file, and upload a new one, all still referenced by the same media node. The macro should render the correct path to the file.
DISCLAIMER: I haven't actually tried this - it's just something I would give a go to see if it works. I hope I haven't misunderstood your requirements.
Cheers,
D.
Hi Dany,
Thanks for the info.
Just to make things more clear, i wan't the end user to change the logo via a property available under the home page, not through a rich text editor.
Based on your idea, here is what i did:
I created a macro with a parameter called "LogoId". The parameter type is "text" (i didn't find a media picker type on the list).
Here is what the macro looks like
After that, i created a property on the document type (MasterPage) called "LogoSite" with type set as "Media Picker". This property will allow the end user to select/change the logo on a specific tab of the home page.
A added the macro to the master page template and passed the page property as a parameter, like this:
And here is the final render:
The only thing i don't get here is why it's rendering "logo.png270509912png" instead of "logo.png".
Is a browser supposed to recognize it as an image? Because Firefox isn't.
That's how I'd do it Danny, although I'm not a big fan of inline styles.
CodeMaster: I think what you could probably use is a crash course in how Umbraco works, for this problem, you could go and read the excellent blog post of Lee Kelleher on how to get media items in XSLT. But I can really recommend you have a look at umbraco.tv (a month's subscription is only €19 and you can cancel after the first month).
D'oh I took too long writing my reply, didn't see your second post CodeMaster! ;)
Instead of $logourl, try: $logourl//data[@alias='umbracoFile'])
You're outputting all of the properties of the media item now by selecting the value of the media node.
I finally got it by making a little change on the macro:
Now the render looks correct to me:
However, it's still not showing the logo. I believe it could be a path problem but, if i try the url bellow, the logo is there.
http://mydomain.com/media/275/logo.png
Just changed the css from "background-image" to "background" and it's now working.
Thanks a lot guys.
Ah... I understand. You don't need parameters on the macro - just use the MediaPicker property on the DocumentType. In your selectors I think you need to use
I hope I've understood you correctly now. This way logourl should give you the right URL to the image file. This is all assuming you're not using the new XML in 4.1 :o)
D'oh! You guys beat me to it :o)
is working on a reply...