Fixes 28050, 28145 and 28176. Various issues with virtual directories and media + xslt

[TFS Changeset #73401]
This commit is contained in:
hartvig
2010-07-20 08:39:13 +00:00
parent 6e8dee9f10
commit 81c799184b
5 changed files with 57 additions and 23 deletions

View File

@@ -285,10 +285,10 @@ namespace umbraco.editorControls.tinyMCE3.webcontrol
private string formatMedia(string html)
{
// Local media path
string localMediaPath = getLocalMediaPath();
string localMediaPath = IOHelper.ResolveUrl(SystemDirectories.Media);
// Find all media images
string pattern = "<img [^>]*src=\"(?<mediaString>/media[^\"]*)\" [^>]*>";
string pattern = String.Format("<img [^>]*src=\"(?<mediaString>{0}[^\"]*)\" [^>]*>", SystemDirectories.Media);
MatchCollection tags =
Regex.Matches(html, pattern, RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);
@@ -321,9 +321,9 @@ namespace umbraco.editorControls.tinyMCE3.webcontrol
// Find the original filename, by removing the might added width and height
orgSrc =
orgSrc.Replace(
IOHelper.ResolveUrl(orgSrc.Replace(
"_" + helper.FindAttribute(ht, "width") + "x" + helper.FindAttribute(ht, "height"), "").
Replace("%20", " ");
Replace("%20", " "));
// Check for either id or guid from media
string mediaId = getIdFromSource(orgSrc, localMediaPath);
@@ -383,6 +383,9 @@ namespace umbraco.editorControls.tinyMCE3.webcontrol
private string getIdFromSource(string src, string localMediaPath)
{
if (!localMediaPath.EndsWith("/"))
localMediaPath += "/";
// important - remove out the umbraco path + media!
src = src.Replace(localMediaPath, "");

View File

@@ -139,8 +139,6 @@ namespace umbraco.editorControls.tinymce
int newWidth = int.Parse(resizeDimSplit[0]);
int newHeight = int.Parse(resizeDimSplit[1]);
//THIS I DO NOW KNOW HOW TO MAKE WORK WITH A VIRTUAL DIRECTORY...
if (orgHeight > 0 && orgWidth > 0 && resizeDim != "" && orgSrc != "")
{
// Check dimensions
@@ -154,9 +152,11 @@ namespace umbraco.editorControls.tinymce
}
// update orgSrc to remove umbraco reference
if (IOHelper.ResolveUrl(orgSrc).IndexOf( IOHelper.ResolveUrl(SystemDirectories.Media)) > -1)
orgSrc = orgSrc.Substring( orgSrc.IndexOf("/media/"), orgSrc.Length - orgSrc.IndexOf("/media/") );
string resolvedMedia = IOHelper.ResolveUrl(SystemDirectories.Media);
if (IOHelper.ResolveUrl(orgSrc).IndexOf(resolvedMedia) > -1)
{
orgSrc = SystemDirectories.Media + orgSrc.Substring(orgSrc.IndexOf(resolvedMedia) + resolvedMedia.Length); //, orgSrc.Length - orgSrc.IndexOf(String.Format("/media/", SystemDirectories.Media)));
}
string ext = orgSrc.Substring(orgSrc.LastIndexOf(".") + 1, orgSrc.Length - orgSrc.LastIndexOf(".") - 1);
newSrc = orgSrc.Replace("." + ext, "_" + newWidth.ToString() + "x" + newHeight.ToString() + ".jpg");