Setting this variable to something other than media gets a NULL value in the cmsMedia table in the mediaPath column.
I'm able to add media but the thumbnails don't work properly. The pathing to the images also works but during the process of picking an image it treats the images as folder paths and blocks the selection.
I manually updated the cmsMedia table to the path pulled from dataNtext from cmsPropertyData and the thumbnails started working.
Am I missing something?
UPDATE media
SET media.mediaPath = JSON_VALUE(convert(nvarchar(max),d.dataNtext),'$.src')
FROM cmsMedia media
JOIN cmsPropertyData d ON d.contentNodeId = nodeId AND d.dataNvarchar IS NULL
Running the above query fixes my issue but I'd rather not have to run that in every environment.
Only 24 records made it into the cmsMedia table when upgrading from 7.5.14 to7.15.3, so I used the script below.
Just beware to use the correct propertyTypeIds for your database, and if your version of SQL Server has JSON (and trim, for that matter), you may want to change this script.
It's not a catchall, but the pattern matching in both parts of the union caught most of the images in our database.
And please, don't use it without testing it out on a test system first, or if you are in any way unsure.
And, check your data afterwards.
/*
Details: Populating the cmsMedia folder from the cmsProperty table for images
*/
delete from cmsMedia;
insert into cmsMedia
(nodeId,versionId,mediaPath)
select p.contentNodeId,
versionId,
rtrim(ltrim(replace(substring(dataNtext,patindex('%src: ''%', dataNtext)+4,patindex('%'',%', substring(dataNtext,patindex('%src: ''%', dataNtext)+5,len(cast(dataNtext as nvarchar(max)))))), '''',''))) as pathname
from cmsPropertyData p
where p.propertytypeid in (6,24)
and patindex('%src: %', datantext) > 0
union
select p.contentNodeId,
versionId,
rtrim(ltrim(replace(substring(dataNtext,patindex('%src": %', dataNtext)+6,patindex('%"%', substring(dataNtext,patindex('%src": %', dataNtext)+7,len(cast(dataNtext as nvarchar(max)))))), '"',''))) as pathname
from cmsPropertyData p
where p.propertytypeid in (6,24)
and patindex('%src": %', datantext) > 0
;
cmsMedia has NULL mediaPath when umbracoMediaPath isn't "~/media"
Setting this variable to something other than media gets a NULL value in the cmsMedia table in the mediaPath column.
I'm able to add media but the thumbnails don't work properly. The pathing to the images also works but during the process of picking an image it treats the images as folder paths and blocks the selection.
I manually updated the cmsMedia table to the path pulled from dataNtext from cmsPropertyData and the thumbnails started working.
Am I missing something?
Running the above query fixes my issue but I'd rather not have to run that in every environment.
Hi Cody
Did you solve this issue?
Thanks, Alex
This issue has been resolved. I submitted a PR to get it fixed and it got included in the 7.15.3 release.
https://github.com/umbraco/Umbraco-CMS/issues/6202
Only 24 records made it into the cmsMedia table when upgrading from 7.5.14 to7.15.3, so I used the script below.
Just beware to use the correct propertyTypeIds for your database, and if your version of SQL Server has JSON (and trim, for that matter), you may want to change this script.
It's not a catchall, but the pattern matching in both parts of the union caught most of the images in our database.
And please, don't use it without testing it out on a test system first, or if you are in any way unsure.
And, check your data afterwards.
Thanks
Muiris
is working on a reply...