Change TinyMCE to use the mediaservice to get the original image + some updates

to the new mediaservice method.
This commit is contained in:
Sebastiaan Janssen
2013-03-26 07:15:22 -01:00
parent f545f293b1
commit 2fd299ebfc
3 changed files with 19 additions and 33 deletions

View File

@@ -325,21 +325,8 @@ namespace umbraco.editorControls.tinyMCE3.webcontrol
orgSrc = IOHelper.ResolveUrl(orgSrc.Replace("%20", " "));
IMedia imageMedia = null;
try
{
var pathStart = orgSrc.Contains("_") ? orgSrc.Substring(0, orgSrc.LastIndexOf("_", StringComparison.Ordinal)) + "%" : orgSrc;
var mediaId = BusinessLogic.Application.SqlHelper.ExecuteScalar<int>(string.Format("SELECT contentNodeId FROM cmsPropertyData WHERE dataNvarchar LIKE '{0}'", pathStart));
var mediaService = ApplicationContext.Current.Services.MediaService;
imageMedia = mediaService.GetById(mediaId);
}
catch (Exception ex)
{
LogHelper.Error<TinyMCEWebControl>("Error getting media item", ex);
}
var mediaService = ApplicationContext.Current.Services.MediaService;
var imageMedia = mediaService.GetMediaByPath(orgSrc);
if (imageMedia == null)
{