Updated the Image thumbnail provider to use IFileSystem

This commit is contained in:
Matt@MBP13-PC
2012-08-14 12:24:51 -01:00
parent 546b53f9b0
commit 766a834f53
2 changed files with 16 additions and 2 deletions

View File

@@ -22,4 +22,6 @@ using System.Runtime.InteropServices;
[assembly: InternalsVisibleTo("umbraco")]
[assembly: InternalsVisibleTo("businesslogic")]
[assembly: InternalsVisibleTo("umbraco.editorControls")]
[assembly: InternalsVisibleTo("Umbraco.Tests")]
[assembly: InternalsVisibleTo("Umbraco.Tests")]
[assembly: InternalsVisibleTo("Our.Umbraco.AmazonS3FileSystem")]

View File

@@ -4,6 +4,7 @@ using System.IO;
using System.Linq;
using System.Text;
using Umbraco.Core;
using Umbraco.Core.IO;
using umbraco.IO;
namespace Umbraco.Web.Media.ThumbnailProviders
@@ -36,8 +37,19 @@ namespace Umbraco.Web.Media.ThumbnailProviders
// Make sure the thumbnail exists
var tmpThumbUrl = fileUrl.Replace(ext, "_thumb.jpg");
if (!File.Exists(IOHelper.MapPath(tmpThumbUrl)))
try
{
var fs = FileSystemProviderManager.Current.GetFileSystemProvider(FileSystemProvider.Media);
var relativeThumbPath = fs.GetRelativePath(tmpThumbUrl);
if (!fs.FileExists(relativeThumbPath))
return false;
}
catch (Exception)
{
// If something odd happens, just return false and move on
return false;
}
// We've got this far, so thumbnail must exist
thumbUrl = tmpThumbUrl;