mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Added thumbnails for pictures in media folder view.
--HG-- branch : 1.x
This commit is contained in:
@@ -252,7 +252,7 @@ namespace Orchard.Media.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult EditMedia(MediaItemEditViewModel model) {
|
||||
model.PublicUrl = _mediaService.GetPublicUrl(Path.Combine(model.MediaPath, model.Name));
|
||||
model.PublicUrl = _mediaService.GetMediaPublicUrl(model.MediaPath, model.Name);
|
||||
return View(model);
|
||||
}
|
||||
|
||||
|
@@ -8,5 +8,6 @@ namespace Orchard.Media.Models {
|
||||
public long Size { get; set; }
|
||||
public string FolderName { get; set; }
|
||||
public DateTime LastUpdated { get; set; }
|
||||
public string MediaPath { get; set; }
|
||||
}
|
||||
}
|
||||
|
@@ -16,6 +16,14 @@ namespace Orchard.Media.Services {
|
||||
/// <returns>The public path relative to the application url.</returns>
|
||||
string GetPublicUrl(string relativePath);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the public URL for a media file.
|
||||
/// </summary>
|
||||
/// <param name="mediaPath">The relative path of the media folder containing the media.</param>
|
||||
/// <param name="fileName">The media file name.</param>
|
||||
/// <returns>The public URL for the media.</returns>
|
||||
string GetMediaPublicUrl(string mediaPath, string fileName);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the media folders within a given relative path.
|
||||
/// </summary>
|
||||
|
@@ -52,6 +52,16 @@ namespace Orchard.Media.Services {
|
||||
return _storageProvider.GetPublicUrl(relativePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the public URL for a media file.
|
||||
/// </summary>
|
||||
/// <param name="mediaPath">The relative path of the media folder containing the media.</param>
|
||||
/// <param name="fileName">The media file name.</param>
|
||||
/// <returns>The public URL for the media.</returns>
|
||||
public string GetMediaPublicUrl(string mediaPath, string fileName) {
|
||||
return GetPublicUrl(Path.Combine(mediaPath, fileName));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the media folders within a given relative path.
|
||||
/// </summary>
|
||||
@@ -79,7 +89,8 @@ namespace Orchard.Media.Services {
|
||||
Size = file.GetSize(),
|
||||
LastUpdated = file.GetLastUpdated(),
|
||||
Type = file.GetFileType(),
|
||||
FolderName = relativePath
|
||||
FolderName = relativePath,
|
||||
MediaPath = GetMediaPublicUrl(relativePath, file.GetName())
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
|
@@ -10,3 +10,9 @@
|
||||
max-height:640px;
|
||||
max-width:640px;
|
||||
}
|
||||
.smallPreviewImage {
|
||||
max-height:64px;
|
||||
max-width:128px;
|
||||
float: left;
|
||||
margin-right: 16px;
|
||||
}
|
@@ -68,6 +68,9 @@
|
||||
size = mediaFile.Size,
|
||||
folderName = mediaFile.FolderName,
|
||||
mediaPath = Model.MediaPath })
|
||||
@if (Html.IsPicture(mediaFile.Name)) {
|
||||
<img src="@mediaFile.MediaPath" class="smallPreviewImage" alt="@mediaFile.Name"/>
|
||||
}
|
||||
</td>
|
||||
<td>@mediaFile.User</td>
|
||||
<td>@mediaFile.LastUpdated</td>
|
||||
|
Reference in New Issue
Block a user