The img src is there, the folder path is correct and maps to the physical file location.
When I save, I see the content is saved to the umbracoPropertyData Table, textValue column, but when I check to see what is saved, it excludes the src path.
I think the reason for this is that should an editor replace the picked image in the Media section, with a different named file, then it would break the stored src link.
So think the strategy is to store picked unique Id, and then the Property Value Converter for the RTE is clever enough to reconstitute the src Url from whatever the latest version is for the particular image.
You aren't really encouraged to access content and media directly via SQL, mainly due to performance, as multiple versions are stored for each item to enable rollback and audit trail, so it can be slow and Umbraco has this concept of a 'published cache' to provide speedy access..
That said... there is an umbracoMediaVersion table that stores the Url to the Media item for a specific version of the Media Item, and if you join this to the umbracoContentVersion table and then again to the umbracoNode table you can get an association between the 'uniqueId' of an item (the guid part of the data-udi) and it's corresponding media path for the 'current' version.
eg
SELECT uniqueId, mv.[path]
FROM [umbracoMediaVersion] mv
INNER JOIN umbracoContentVersion cv on cv.id = mv.id
INNER JOIN umbracoNode un on un.id = cv.nodeid
Where [current] = 1
Understand that I am not supposed to directly access db, and that would be the case if I was using an umbraco generated front end as my site, but I don't have that choice.
I am using a non umbraco regular website and a requirement is to be able to grab the stored html content that's saved by the umbraco backend and display it on this third party website.
Doing a lookup on the guid and having to replace every instance of each img tag may not work for this scenario.
Is there anyway to disable or configure this behavior so it populates the img src tag?
Similar things I've done in the past when I've needed to access the content managed by Umbraco, but have only had access to the Database from the third-party app (eg. using an API endpoint wouldn't be appropriate) - is to create a new Database Table called ContentBroker (this is terminology from how a CMS called Tridion used to work) - I'd then use the Published Notification of the Content Service inside Umbraco,
which would give me access to the published content of the item and insert this into the ContentBroker database table.
The ContentBroker would just then have columns for the data that need to be stored and would be flat to make it easily queryable.
I'd tap into the ContentUnpublishingNotification and ContentDeletedNotificaitons to remove any item from the ContentBroker.
This way you can query the data from the third party app and it's ready to go, placeholder for an image or for a macro will be rendered as HTML and so you can insert this published outcome into the db table for easy retrieval.
More recently I've used services such as Redis Cache or Azure Search to be the 'medium' in between the Umbraco CMS and the third party system needing to consume things, but the principle is the same.
If you are keen to stick to the same database table structure as Umbraco, then perhaps you could add a readonly label to your DocType and then in the ContentService Saving event, do the work to process the rich text editor content, getting the Url etc, and then populate the Label field programmatically with the output, giving you the content stored in the format you are used to?
I will look into those suggestions. I am currently trying to setup the current umbraco solution so I can perhaps create an extension and try to play with some of your suggestions. Of course nothing is easy since I am on VS2017 and need the 7 framework to get up and running, but hopefully I can get the solution to build and try out some of this.
umbracoPropertyData Table textValue field not saving img src
Umbraco 12
I am using a direct sql call to grab some content from my umbraco site for a non umbraco site.
I see that when I save content in umbraco and add an image, in the editor if I look at the edit source code it will show me the html as this:
img src="/media/zjlnbqej/test.png?rmode=max&width=250&height=98" alt="" width="250" height="98" data-udi="umb://media/c0c057cc978941b6ad532bff8f8800ff"
The img src is there, the folder path is correct and maps to the physical file location.
When I save, I see the content is saved to the umbracoPropertyData Table, textValue column, but when I check to see what is saved, it excludes the src path.
img src="?rmode=max&width=250&height=98" alt="" width="250" height="98" data-udi="umb://media/c0c057cc978941b6ad532bff8f8800ff"
I need to grab the content from that textValue column and need the img src path there, saved into the db.
Anyone know why this information gets excluded? or if there is a way to make that path get saved into that textValue column?
Thanks....
Hi Richard
I think the reason for this is that should an editor replace the picked image in the Media section, with a different named file, then it would break the stored src link.
So think the strategy is to store picked unique Id, and then the Property Value Converter for the RTE is clever enough to reconstitute the src Url from whatever the latest version is for the particular image.
You aren't really encouraged to access content and media directly via SQL, mainly due to performance, as multiple versions are stored for each item to enable rollback and audit trail, so it can be slow and Umbraco has this concept of a 'published cache' to provide speedy access..
That said... there is an umbracoMediaVersion table that stores the Url to the Media item for a specific version of the Media Item, and if you join this to the umbracoContentVersion table and then again to the umbracoNode table you can get an association between the 'uniqueId' of an item (the guid part of the data-udi) and it's corresponding media path for the 'current' version.
eg
but you aren't really meant to do this!
regards
marc
Thanks Marc.
Understand that I am not supposed to directly access db, and that would be the case if I was using an umbraco generated front end as my site, but I don't have that choice.
I am using a non umbraco regular website and a requirement is to be able to grab the stored html content that's saved by the umbraco backend and display it on this third party website.
Doing a lookup on the guid and having to replace every instance of each img tag may not work for this scenario.
Is there anyway to disable or configure this behavior so it populates the img src tag?
Hi rich
Similar things I've done in the past when I've needed to access the content managed by Umbraco, but have only had access to the Database from the third-party app (eg. using an API endpoint wouldn't be appropriate) - is to create a new Database Table called ContentBroker (this is terminology from how a CMS called Tridion used to work) - I'd then use the Published Notification of the Content Service inside Umbraco,
https://docs.umbraco.com/umbraco-cms/reference/notifications/contentservice-notifications
which would give me access to the published content of the item and insert this into the ContentBroker database table.
The ContentBroker would just then have columns for the data that need to be stored and would be flat to make it easily queryable.
I'd tap into the ContentUnpublishingNotification and ContentDeletedNotificaitons to remove any item from the ContentBroker.
This way you can query the data from the third party app and it's ready to go, placeholder for an image or for a macro will be rendered as HTML and so you can insert this published outcome into the db table for easy retrieval.
More recently I've used services such as Redis Cache or Azure Search to be the 'medium' in between the Umbraco CMS and the third party system needing to consume things, but the principle is the same.
If you are keen to stick to the same database table structure as Umbraco, then perhaps you could add a readonly label to your DocType and then in the ContentService Saving event, do the work to process the rich text editor content, getting the Url etc, and then populate the Label field programmatically with the output, giving you the content stored in the format you are used to?
regards
Marc
Thanks again Marc.
I will look into those suggestions. I am currently trying to setup the current umbraco solution so I can perhaps create an extension and try to play with some of your suggestions. Of course nothing is easy since I am on VS2017 and need the 7 framework to get up and running, but hopefully I can get the solution to build and try out some of this.
-rich
is working on a reply...