Adds the new resize logic to the Richtext Editor (tinymce) as well

This commit is contained in:
hartvig
2012-07-04 09:15:16 -02:00
parent 5568ea8e78
commit e481f4e0af
2 changed files with 7 additions and 4 deletions

View File

@@ -6,6 +6,7 @@ using System.Drawing.Imaging;
using System.Text.RegularExpressions;
using System.Web;
using umbraco.BusinessLogic;
using umbraco.cms.businesslogic.Files;
using umbraco.IO;
namespace umbraco.editorControls.tinymce
@@ -164,12 +165,13 @@ namespace umbraco.editorControls.tinymce
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");
string fullSrc = IOHelper.MapPath(orgSrc);
string fullSrcNew = IOHelper.MapPath(newSrc);
UmbracoFile uf = new UmbracoFile(fullSrc);
newSrc = uf.Resize(newWidth, newHeight);
/*
// Load original image
Image image = Image.FromFile(fullSrc);
@@ -200,6 +202,7 @@ namespace umbraco.editorControls.tinymce
// Save the new image
bp.Save(fullSrcNew, codec, ep);
* */
}
// return the new width and height

View File

@@ -268,7 +268,7 @@ namespace umbraco.editorControls
try
{
hasThumb = File.Exists(IOHelper.MapPath(IOHelper.FindFile(fileNameThumb)));
// 4.8.0 added support for png thumbnails
// 4.8.0 added support for png thumbnails (but for legacy it might have been jpg - hence the check before)
if (!hasThumb && (ext == "gif" || ext == "png"))
{
fileNameThumb = _text.Replace("." + ext, "_thumb.png");