This commit is contained in:
sebastiaan
2012-08-08 11:40:31 -02:00

View File

@@ -84,28 +84,31 @@ namespace umbraco.cms.businesslogic.datatype
// check for auto fill of other properties (width, height, extension and filesize)
string propertyTypeAlias = new Property(PropertyId).PropertyType.Alias;
XmlNode uploadFieldConfigNode =
UmbracoSettings.ImageAutoFillImageProperties.SelectSingleNode(
string.Format("uploadField [@alias = \"{0}\"]", propertyTypeAlias));
if (uploadFieldConfigNode != null)
if (UmbracoSettings.ImageAutoFillImageProperties != null)
{
// get the current document
Content content = Content.GetContentFromVersion(Version);
// only add dimensions to web images
if (um.SupportsResizing)
XmlNode uploadFieldConfigNode =
UmbracoSettings.ImageAutoFillImageProperties.SelectSingleNode(
string.Format("uploadField [@alias = \"{0}\"]", propertyTypeAlias));
if (uploadFieldConfigNode != null)
{
updateContentProperty(uploadFieldConfigNode, content, "widthFieldAlias",
um.GetDimensions().Item1);
updateContentProperty(uploadFieldConfigNode, content, "heightFieldAlias",
um.GetDimensions().Item2);
// get the current document
Content content = Content.GetContentFromVersion(Version);
// only add dimensions to web images
if (um.SupportsResizing)
{
updateContentProperty(uploadFieldConfigNode, content, "widthFieldAlias",
um.GetDimensions().Item1);
updateContentProperty(uploadFieldConfigNode, content, "heightFieldAlias",
um.GetDimensions().Item2);
}
else
{
updateContentProperty(uploadFieldConfigNode, content, "widthFieldAlias", String.Empty);
updateContentProperty(uploadFieldConfigNode, content, "heightFieldAlias", String.Empty);
}
updateContentProperty(uploadFieldConfigNode, content, "lengthFieldAlias", um.Length);
updateContentProperty(uploadFieldConfigNode, content, "extensionFieldAlias", um.Extension);
}
else
{
updateContentProperty(uploadFieldConfigNode, content, "widthFieldAlias", String.Empty);
updateContentProperty(uploadFieldConfigNode, content, "heightFieldAlias", String.Empty);
}
updateContentProperty(uploadFieldConfigNode, content, "lengthFieldAlias", um.Length);
updateContentProperty(uploadFieldConfigNode, content, "extensionFieldAlias", um.Extension);
}
base.Value = um.LocalName;
@@ -142,18 +145,21 @@ namespace umbraco.cms.businesslogic.datatype
private void clearRelatedValues()
{
string propertyTypeAlias = new Property(PropertyId).PropertyType.Alias;
XmlNode uploadFieldConfigNode =
UmbracoSettings.ImageAutoFillImageProperties.SelectSingleNode(
string.Format("uploadField [@alias = \"{0}\"]", propertyTypeAlias));
if (uploadFieldConfigNode != null)
if (UmbracoSettings.ImageAutoFillImageProperties != null)
{
// get the current document
Content content = Content.GetContentFromVersion(Version);
// only add dimensions to web images
updateContentProperty(uploadFieldConfigNode, content, "widthFieldAlias", String.Empty);
updateContentProperty(uploadFieldConfigNode, content, "heightFieldAlias", String.Empty);
updateContentProperty(uploadFieldConfigNode, content, "lengthFieldAlias", String.Empty);
updateContentProperty(uploadFieldConfigNode, content, "extensionFieldAlias", String.Empty);
XmlNode uploadFieldConfigNode =
UmbracoSettings.ImageAutoFillImageProperties.SelectSingleNode(
string.Format("uploadField [@alias = \"{0}\"]", propertyTypeAlias));
if (uploadFieldConfigNode != null)
{
// get the current document
Content content = Content.GetContentFromVersion(Version);
// only add dimensions to web images
updateContentProperty(uploadFieldConfigNode, content, "widthFieldAlias", String.Empty);
updateContentProperty(uploadFieldConfigNode, content, "heightFieldAlias", String.Empty);
updateContentProperty(uploadFieldConfigNode, content, "lengthFieldAlias", String.Empty);
updateContentProperty(uploadFieldConfigNode, content, "extensionFieldAlias", String.Empty);
}
}
}