-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Media thumbnails not shown after 7.14.0 -> 7.15.0 upgrade #5847
Comments
Can you show what you had to update? And where do you see errors/problems? Not sure why cmsMedia has nulls unless it's a media item without a filled in |
I think the key to understanding this is this:
Which sounds like potentially very old versions of umbraco before there was a cmsMedia table that tracked media paths? |
Here is the SQL I used (I had to code it up in C# in order to process the json variants, but this is effectively what I did)
```
UPDATE [cmsMedia] SET mediaPath = cmsPropertyData.dataNvarchar
FROM
(
select contentNodeId, dataNvarchar from cmsPropertyData
)cmsPropertyData
WHERE mediaPath IS NULL AND cmsMedia.nodeId = cmsPropertyData.contentNodeId
```
The site was new at 7.14.0 so it is not that it was an old version. If you edit the thumbnail and save the node, the mediaPath is then added to the database correctly, but with thousands of images obviously this is not practical.
The document type contains a gallery property of type Umbraco.MediaPicker2 with “Pick Multiple Items” selected.
Our production site, which has not yet been upgraded (still 7.14.0), shows the thumbnails correctly without all the extra data in the mediaPath column. When I upgraded the staging version (which points to a very recent copy of the prod database, less than two days old) the thumbnails disappeared. After a bit of SQL’ing I took a guess at what was missing, updated a few manually which fixed the issue then wrote the code to update all rows in cmsMedia where mediaPath was NULL.
I can see the angular error “Cannot resolve the file url from the mediaEntity, it does not contain the required metaData” comes from here
https://pastebin.com/pVrdnci5
but have not yet delved any deeper into the umbraco source code. I got our content guy to create a new gallery, they just use the standard media picker, no import tools or anything like that.
|
Just looking into this further, I think I can see why the mediaPath was NULL. My predecessor on this project was bsowa who asked a question relating to issue @nul800sebastiaan replied with a code snippet to replace the SetMediaNameToFilename This code snippet is being used by our solution but is missing setting the media.Path property at the end. I think we need this
I have not tested this, just reading the code, but I believe this is where our NULL mediaPath DB entries have originated from. This still does not explain why the thumbnails were appearing in 7.14.0 and not in 7.15.0 though |
To explain why this might have worked in 7.14: in 7.15 we updated a lot of the underlying code for retrieving media items because in 7.14 it was giving back ALL of the properties of each media item in the media picker. That was way too much info and with the introduction of the feature from PR #2441 we did not want to expose the full set of data to all editors. So it looks like we might need a migration that populates the mediaPath during an upgrade. I'm a bit concerned about @JamesSherborne's site though, as he mentions in #6106 he has 17000 items that need an update, not sure how well that will perform. |
@JamesSherborne, could you post your Also, can you tell whether older media items have their mediaPath populated and newer ones are broken, or vice versa? (I'm going to optimistically assume that it's one of those, and not a random mix of populated and null). |
@stevemegson attached is the FileSystemProviders.config With regards to the mediaPath, I have just added a new image to test. Steps:
The cmsMedia table shows that this item does not have a mediaPath. It is not selectable in the Media Picker. Conversely, if I follow the same steps as above but using the "original" Image Media Type the node does get a mediaPath and is selectable. The "original" Image Media Type again uses an Image Crop for the file upload. I say "original" as it may well have been amended at some point but is the "Image" Media Type which comes OOTB. Differences:
|
It'll be the property aliases causing the problem. As noted in comments in the code, v8 should really allow each property editor to determine whether it represents the mediaPath and what that path should be. A quicker fix for 7.15, and perhaps a temporary fix for v8, would be to recreate the logic from 7.14. That is, find the first Upload or Image Cropper property and use that path. That would deal with new media items, leaving the problem of existing NULLs in the database. There was a migration in 7.8.0 to populate the |
@stevemegson if I were to rename the aliases in my project to umbracoFile, is there a way for me get Umbraco to create the mediaPath automatically? |
@JamesSherborne in principle you could make 7.15 think that your database needs upgrading from pre-7.8.0, then the "upgrade" would recreate the cmsMedia table. Something like:
|
@stevemegson tahnks, looks like your proposed steps do the trick. Umbraco seems to have no problem parsing all of the images but I now only have 6000 rows in the cmsMedia table rather than the 23000 I started with. Is this because it fails to process all or does the migration perform some housekeeping? |
I guess the migration won't have recreated rows for any old versions of your custom items, since those versions didn't have an |
@stevemegson No warning in developer console, but I can see that image.thumbnail = "" with ng-inspect/AngularJs In my old version 7.14.0: image.thumbnail = "/umbraco/backoffice/UmbracoApi/Images/GetBigThumbnail?originalImagePath=xxx" When will this be fixed? I need to tell my client :) |
I have the same problem as @stevemegson on 7.15.3 but only on using an Azure WebApp with blobstorage. I have seen something similar for missing images in the back office and have checked the web.config in the media folder. Sadly the fix I used in 7.15.2 for when images weren't displaying at all, is in this folder, so the issue is just for thumbnails too: <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<clear/>
<add name="StaticFileHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.StaticFileHandler"/>
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either"
requireAccess="Read"/>
</handlers>
</system.webServer>
</configuration> |
Hi @RachBreeze |
Hi @banarualexandru |
PS there's also |
I'm experiencing this issue on an Umbraco 7.15.3 site with Courier 3.1.7.0. Everything is fine on the authoring site. I can create a new media node, see the preview thumbnails, and see the corresponding entry in the The site has always used the default It seems like a similar problem. Should we discuss it here or should I create a new issue for it possibly as a Courier issue? |
It appears in v7.15.0 the ImageProcessor now uses cmsMedia.mediaPath to display thumbnails. In many cases this field is NULL when images have been imported into Umbraco in a previous version.
This is characterized by angular reporting "Cannot resolve the file url from the mediaEntity, it does not contain the required metaData" in the developer tools console window.
In order to make the thumbnails appear correctly I had to write some code to update the mediaPath column from the cmsPropertyData table. The data exists in either the dataNvarchar or within a json string in the dataNtext.
This should be taken care of as part of the upgrade process ?
This item has been added to our backlog AB#7181
The text was updated successfully, but these errors were encountered: