Hello, I have query related to media tree node content. I have developed a site and published it. But now I want to replace the existing image. So when I am adding image with same name under 'Media' node it creates new image with (1) name.
Means if I have image with name 'Untitled.png' under 'Media' node, then I add image with same name then it creates a new with name 'Untitled(1).png'. I want to overwrite the image only.
How can I overwrite the image? Help me with this issue ASAP. I got headache in this image replacing issue.
I think this is how Umbraco handles uploads with the same name by default. Would be quite scary if Umbraco would override a Image with the same name by default. Not sure if you can configure it to override images with tha same name.
To replace a existing image, click on the image in Media, then "Remove file(s)", and then upload a new file with the same filename (to preserve the link to the image).
Oh, sorry if i explained myself badly. I dont suggest you remove the entire media node, just the image inside the node. That way the ID of the node remaions the same but you replace the image.
Using your way MediaID is not changing. But in project solution under media folder it is generating new folder. And to display I am not using media ID I am using it like this :
Ah, i see. Well then you probobly have to update the folder path or fetch the image in your view using a Media ID instead of the path. That could probobly be a good idea anyway for the future if you´re changing the image again.
Great to hear that it worked for you! Glad that i can be off help.
In your case with the css class, since you already set how you´d like background to be rendered, you just have to specify the background image in your view and it should be fine:
Overwrite image in 'Media' node
Hello, I have query related to media tree node content. I have developed a site and published it. But now I want to replace the existing image. So when I am adding image with same name under 'Media' node it creates new image with (1) name.
Means if I have image with name 'Untitled.png' under 'Media' node, then I add image with same name then it creates a new with name 'Untitled(1).png'. I want to overwrite the image only.
How can I overwrite the image? Help me with this issue ASAP. I got headache in this image replacing issue.
Thanks, Dipa
Hi Dipa.
I think this is how Umbraco handles uploads with the same name by default. Would be quite scary if Umbraco would override a Image with the same name by default. Not sure if you can configure it to override images with tha same name.
To replace a existing image, click on the image in Media, then "Remove file(s)", and then upload a new file with the same filename (to preserve the link to the image).
Hope this helps you!
Hi Dennis,
I can not follow your suggestion. Because in template I have used that image like this :
If I will remove and add new one then it will generate new Id for it and image will not be displayed.
Can you suggest me any other way for this issue? Please help me.
Thanks, Dipa
Oh, sorry if i explained myself badly. I dont suggest you remove the entire media node, just the image inside the node. That way the ID of the node remaions the same but you replace the image.
Thanks Dennis,
I got the solution.
Awsome, great to hear. Glad i could help! :)
Have a great day!!
Hi Dennis, Your help was helpful.
Using your way MediaID is not changing. But in project solution under media folder it is generating new folder. And to display I am not using media ID I am using it like this :
Did you get my point?
Ah, i see. Well then you probobly have to update the folder path or fetch the image in your view using a Media ID instead of the path. That could probobly be a good idea anyway for the future if you´re changing the image again.
Hi Dennis,
Your suggestion works perfectly for me in any html or cshtml page. That is good way to use mediaID to render it.
But I have one more query. If I want to use same in style(.css) file then ? Means I have a class like below :
CSS
HTML
How can I use mediaID in this case? Please help me with this.
Thanks.
Great to hear that it worked for you! Glad that i can be off help.
In your case with the css class, since you already set how you´d like background to be rendered, you just have to specify the background image in your view and it should be fine:
Leave your class the way it is, and the rest of your defined styles will be applied from your class.
is working on a reply...