Created
May 16, 2017 19:53
-
-
Save carlwoodhouse/b5041cb9e3fc29b5ddc75a5d94ece915 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Orchard; | |
using Orchard.Autoroute.Services; | |
using Orchard.Environment.Extensions; | |
using Orchard.FileSystems.Media; | |
using Orchard.MediaLibrary.Factories; | |
using Orchard.MediaLibrary.Services; | |
using System.Collections.Generic; | |
using System.IO; | |
namespace Patient.Framework.Media { | |
[OrchardSuppressDependency("Orchard.MediaLibrary.Services.MediaLibraryService")] | |
public class MediaService : MediaLibraryService, IMediaLibraryService { | |
private readonly ISlugService _slugService; | |
public MediaService(IOrchardServices orchardServices, | |
IMimeTypeProvider mimeTypeProvider, | |
IStorageProvider storageProvider, | |
IEnumerable<IMediaFactorySelector> mediaFactorySelectors, | |
ISlugService slugService) : | |
base(orchardServices, mimeTypeProvider, storageProvider, mediaFactorySelectors) { | |
_slugService = slugService; | |
} | |
public new string GetUniqueFilename(string folderPath, string filename) { | |
filename = filename.ToLower(); | |
// slugify filename to remove spaces | |
filename = string.Concat(_slugService.Slugify(Path.GetFileNameWithoutExtension(filename)), Path.GetExtension(filename)); | |
return base.GetUniqueFilename(folderPath, filename); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment