U4-1368 - Media properties aren't set after image is uploaded - UmbracoCms.6.0.0.build.94

Created by Jeroen Breuer 29 Dec 2012, 19:24:29 Updated by Jeroen Breuer 14 Jan 2013, 21:37:12

Relates to: U4-1371

Relates to: U4-1372

Relates to: U4-1438

After uploading an image the other media properties aren't set automatically. See attachment. Settings in the UmbracoSettings.config seem correct:

jpeg,jpg,gif,bmp,png,tiff,tif

alt,border,class,style,align,id,name,onclick,usemap

umbracoWidth umbracoHeight umbracoBytes umbracoExtension {code}

1 Attachments

Comments

Jeroen Breuer 02 Jan 2013, 05:58:59

Looks like in umbraco.cms/businesslogic/datatype/FileHandlerData.cs there is the following code: Content content = Content.GetContentFromVersion(Version); This probably is the same problem as the issue where [values aren't available in the before save event.|http://issues.umbraco.org/issue/U4-1372] when you're using this: Media(mediaId).getProperty("umbracoFile") instead of this: sender.getProperty("umbracoFile") This code is executed each time the upload property is set. So when using the normal create option in the media section, but also the new 4.9 multiple file uploader or create option of the RTE. It's also used when you create media in DAMP.


Morten Christensen 02 Jan 2013, 15:43:18

Fixed this by writing a BeforeSave event subscriber for the legacy Document and Media classes, so the values are set properly prior to the content being saved. It wasn't possible to keep this entirely in the DataTypeUploadField class, but its probably for the better :)


Morten Christensen 02 Jan 2013, 15:44:48

One thing I noticed is that once the image is uploaded you have to re-load the node to have the values of the properties displayed. Not sure if this is normal behaviour in the Media section? Haven't tried it on regular Content node.


Jeroen Breuer 02 Jan 2013, 15:46:28

I think you should ask Tim about that. He once created a fix so that the image didn't have to be reloaded, but that might not work with the new save event fix you created.


Priority: Normal

Type: Bug

State: Fixed

Assignee: Morten Christensen

Difficulty: Normal

Category:

Backwards Compatible: True

Fix Submitted:

Affected versions: 6.0.0

Due in version: 6.0.0

Sprint:

Story Points:

Cycle: